diff --git a/dist/am-utils/amd/amd.8 b/dist/am-utils/amd/amd.8 index 6f5da33956e1..926fb46926f9 100644 --- a/dist/am-utils/amd/amd.8 +++ b/dist/am-utils/amd/amd.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: amd.8,v 1.2 2001/12/18 09:31:47 wiz Exp $ +.\" $NetBSD: amd.8,v 1.3 2002/11/29 23:06:22 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -40,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" Id: amd.8,v 1.4.2.1 2001/01/10 03:22:59 ezk Exp +.\" Id: amd.8,v 1.7 2002/06/22 20:52:44 ezk Exp .\" .TH AMD 8 "3 November 1989" .SH NAME @@ -78,6 +78,8 @@ amd \- automatically mount file systems ] [ .BI \-y " YP-domain" ] [ +.BI \-A " arch" +] [ .BI \-C " cluster-name" ] [ .BI \-D " option" @@ -245,6 +247,11 @@ 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 \-A " arch" +Specifies the OS architecture. This is used solely to set the ${arch} +selector. + .TP .BI \-C " cluster-name" Specify an alternative HP-UX cluster name to use. diff --git a/dist/am-utils/amd/amd.c b/dist/am-utils/amd/amd.c index d168894145a9..feccf000a323 100644 --- a/dist/am-utils/amd/amd.c +++ b/dist/am-utils/amd/amd.c @@ -1,7 +1,7 @@ -/* $NetBSD: amd.c,v 1.3 2001/05/13 18:06:57 veego Exp $ */ +/* $NetBSD: amd.c,v 1.4 2002/11/29 23:06:22 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: amd.c,v 1.8.2.3 2001/01/10 03:22:59 ezk Exp + * Id: amd.c,v 1.19 2002/06/23 01:05:38 ib42 Exp * */ @@ -73,6 +72,10 @@ struct amd_stats amd_stats; /* Server statistics */ struct in_addr myipaddr; /* (An) IP address of this host */ time_t do_mapc_reload = 0; /* mapc_reload() call required? */ +#ifdef HAVE_FS_AUTOFS +int amd_use_autofs = 0; +#endif /* HAVE_FS_AUTOFS */ + #ifdef HAVE_SIGACTION sigset_t masked_sigs; #endif /* HAVE_SIGACTION */ @@ -120,10 +123,8 @@ sighup(int sig) signal(sig, sighup); #endif /* REINSTALL_SIGNAL_HANDLER */ -#ifdef DEBUG if (sig != SIGHUP) dlog("spurious call to sighup"); -#endif /* DEBUG */ /* * Force a reload by zero'ing the timer */ @@ -274,6 +275,9 @@ init_global_options(void) /* dismount interval */ gopt.am_timeo_w = AM_TTL_W; + /* map reload intervl */ + gopt.map_reload_interval = ONE_HOUR; + /* * various CFM_* flags. * by default, only the "plock" option is on (if available). @@ -504,8 +508,13 @@ main(int argc, char *argv[]) /* * Lock process text and data segment in memory. */ -#ifdef HAVE_PLOCK if (gopt.flags & CFM_PROCESS_LOCK) { +#if defined(HAVE_PLOCK) || defined(HAVE_MLOCKALL) + int locked_ok = 0; +#else /* not HAVE_PLOCK and not HAVE_MLOCKALL */ + plog(XLOG_WARNING, "Process memory locking not supported by the OS"); +#endif /* not HAVE_PLOCK and not HAVE_MLOCKALL */ +#ifdef HAVE_PLOCK # ifdef _AIX /* * On AIX you must lower the stack size using ulimit() before calling @@ -516,13 +525,22 @@ main(int argc, char *argv[]) */ plog(XLOG_WARNING, "AIX: may need to lower stack size using ulimit(3) before calling plock"); # endif /* _AIX */ - 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"); - } - } + if (!locked_ok && plock(PROCLOCK) != 0) + plog(XLOG_WARNING, "Couldn't lock process pages in memory using plock(): %m"); + else + locked_ok = 1; #endif /* HAVE_PLOCK */ +#ifdef HAVE_MLOCKALL + if (!locked_ok && mlockall(MCL_CURRENT|MCL_FUTURE) != 0) + plog(XLOG_WARNING, "Couldn't lock process pages in memory using mlockall(): %m"); + else + locked_ok = 1; +#endif /* HAVE_MLOCKALL */ +#if defined(HAVE_PLOCK) || defined(HAVE_MLOCKALL) + if (locked_ok) + plog(XLOG_INFO, "Locked process pages in memory"); +#endif /* HAVE_PLOCK || HAVE_MLOCKALL */ + } #ifdef HAVE_MAP_NIS /* @@ -543,7 +561,7 @@ main(int argc, char *argv[]) sprintf(pid_fsname, "%s:(pid%ld)", am_get_hostname(), (long) am_mypid); - do_mapc_reload = clocktime() + ONE_HOUR; + do_mapc_reload = clocktime() + gopt.map_reload_interval; /* * Register automounter with system. @@ -551,6 +569,13 @@ main(int argc, char *argv[]) error = mount_automounter(ppid); if (error && ppid) kill(ppid, SIGALRM); + +#ifdef HAVE_FS_AUTOFS + /* XXX this should be part of going_down(), but I can't move it there because it would be calling non-library code from the library... ugh */ + if (amd_use_autofs) + destroy_autofs_service(); +#endif /* HAVE_FS_AUTOFS */ + going_down(error); abort(); diff --git a/dist/am-utils/amd/amq_subr.c b/dist/am-utils/amd/amq_subr.c index 5ee508030e70..d653feab818b 100644 --- a/dist/am-utils/amd/amq_subr.c +++ b/dist/am-utils/amd/amq_subr.c @@ -1,7 +1,7 @@ -/* $NetBSD: amq_subr.c,v 1.5 2001/05/13 18:06:57 veego Exp $ */ +/* $NetBSD: amq_subr.c,v 1.6 2002/11/29 23:06:22 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: amq_subr.c,v 1.6.2.2 2001/01/12 22:43:42 ro Exp + * Id: amq_subr.c,v 1.12 2002/06/23 01:05:38 ib42 Exp * */ /* @@ -132,9 +131,7 @@ amqproc_setopt_1_svc(voidp argp, struct svc_req *rqstp) switch (opt->as_opt) { case AMOPT_DEBUG: -#ifdef DEBUG if (debug_option(opt->as_str)) -#endif /* DEBUG */ rc = EINVAL; break; @@ -356,7 +353,7 @@ xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead) u_int len = 0; for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) { - if (!(mf->mf_ops->fs_flags & FS_AMQINFO)) + if (!(mf->mf_fsflags & FS_AMQINFO)) continue; len++; } @@ -367,7 +364,7 @@ xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead) */ for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) { int up; - if (!(mf->mf_ops->fs_flags & FS_AMQINFO)) + if (!(mf->mf_fsflags & FS_AMQINFO)) continue; if (!xdr_amq_string(xdrs, &mf->mf_ops->fs_type)) { diff --git a/dist/am-utils/amd/opts.c b/dist/am-utils/amd/opts.c index 85ffb0228b35..0c1e132bf621 100644 --- a/dist/am-utils/amd/opts.c +++ b/dist/am-utils/amd/opts.c @@ -1,7 +1,7 @@ -/* $NetBSD: opts.c,v 1.3 2001/05/13 18:06:57 veego Exp $ */ +/* $NetBSD: opts.c,v 1.4 2002/11/29 23:06:22 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: opts.c,v 1.8.2.4 2001/01/10 03:23:11 ezk Exp + * Id: opts.c,v 1.23 2002/06/23 01:05:39 ib42 Exp * */ @@ -101,6 +100,7 @@ static int f_netgrpd(char *); static int f_exists(char *); static int f_false(char *); static int f_true(char *); +static inline char *expand_options(char *key); /* * STATICS: @@ -127,7 +127,7 @@ struct am_opts fs_static; /* copy of the options to play with */ /* - * Options in something corresponding to frequency of use so that + * Options in some order corresponding to frequency of use so that * first-match algorithm is sped up. */ static struct opt opt_fields[] = { @@ -203,7 +203,6 @@ static struct opt opt_fields[] = { 0, &opt_dkey, 0, FALSE }, { S("key."), 0, &opt_keyd, 0, FALSE }, - /* XXX: should maptype really be a variable? I think selector. -Erez */ { S("maptype"), &fs_static.opt_maptype, 0, 0, FALSE }, { S("cachedir"), @@ -214,6 +213,8 @@ static struct opt opt_fields[] = { 0, &opt_uid, 0, FALSE }, { S("gid"), 0, &opt_gid, 0, FALSE }, + { S("mount_type"), + &fs_static.opt_mount_type, 0, 0, FALSE }, { S("dollar"), &literal_dollar, 0, 0, FALSE }, { S("var0"), @@ -459,33 +460,99 @@ functable_lookup(char *key) } +/* + * Fill in the global structure fs_static by + * cracking the string opts. opts may be + * scribbled on at will. Does NOT evaluate options. + * Returns 0 on error, 1 if no syntax errors were discovered. + */ static int -eval_opts(char *opts, char *mapkey) +split_opts(char *opts, char *mapkey) { - /* - * Fill in the global structure fs_static by - * cracking the string opts. opts may be - * scribbled on at will. - */ char *o = opts; char *f; /* * For each user-specified option */ - while (*(f = opt(&o))) { + for (f = opt(&o); *f; f = opt(&o)) { struct opt *op; - enum vs_opt vs_opt = VarAss; + char *eq = strchr(f, '='); + char *opt = NULL; + + if (!eq) + continue; + + if (eq[-1] == '!' || + eq[1] == '=' || + eq[1] == '!') { /* != or == or =! */ + continue; /* we don't care about selectors */ + } + + if (eq[-1] == ':') { /* := */ + eq[-1] = '\0'; + } else { + /* old style assignment */ + eq[0] = '\0'; + } + opt = eq + 1; + + /* + * For each recognized option + */ + for (op = opt_fields; op->name; op++) { + /* + * Check whether they match + */ + if (FSTREQ(op->name, f)) { + if (op->sel_p) { + plog(XLOG_USER, "key %s: Can't assign to a selector (%s)", + mapkey, op->name); + return 0; + } + *op->optp = opt; /* actual assignment into fs_static */ + break; /* break out of for loop */ + } /* end of "if (FSTREQ(op->name, f))" statement */ + } /* end of "for (op = opt_fields..." statement */ + + if (!op->name) + plog(XLOG_USER, "key %s: Unrecognized key/option \"%s\"", mapkey, f); + } + + return 1; +} + + +/* + * Just evaluate selectors, which were split by split_opts. + * Returns 0 on error or no match, 1 if matched. + */ +static int +eval_selectors(char *opts, char *mapkey) +{ + char *o, *old_o; + char *f; + int ret = 0; + + o = old_o = strdup(opts); + + /* + * For each user-specified option + */ + for (f = opt(&o); *f; f = opt(&o)) { + struct opt *op; + enum vs_opt vs_opt; char *eq = strchr(f, '='); char *fx; IntFuncPtr func; char *opt = NULL; + char *arg; - if (!eq || eq[1] == '\0' || eq == f) { + if (!eq) { /* * No value, is it a function call? */ - char *arg = strchr(f, '('); + arg = strchr(f, '('); if (!arg || arg[1] == '\0' || arg == f) { /* @@ -504,43 +571,54 @@ eval_opts(char *opts, char *mapkey) } *fx = '\0'; + if (f[0] == '!') { + vs_opt = SelNE; + f++; + } else { + vs_opt = SelEQ; + } /* * look up f in functable and pass it arg. * func must return 0 on failure, and 1 on success. */ if ((func = functable_lookup(f))) { - if (!(*func) (arg)) { - return (0); - } - continue; - } else if (NSTREQ(f, "!", 1) && (func = functable_lookup(&f[1]))) { - /* then this is a negated prefixed function such as "!exists" */ - plog(XLOG_INFO, "executing negated function %s", &f[1]); - if ((*func) (arg)) { - return (0); - } + int funok; + + /* this allocates memory, don't forget to free */ + arg = expand_options(arg); + funok = func(arg); + XFREE(arg); + + if (vs_opt == SelNE) + funok = !funok; + if (!funok) + goto out; + continue; } else { plog(XLOG_USER, "key %s: unknown function \"%s\"", mapkey, f); - return (0); + goto out; + } + } else { + if (eq[1] == '\0' || eq == f) { + /* misformed selector */ + plog(XLOG_USER, "key %s: Bad selector \"%s\"", mapkey, f); + continue; } - } /* * Check what type of operation is happening * !=, =! is SelNE * == is SelEQ - * := is VarAss + * =, := is VarAss */ if (eq[-1] == '!') { /* != */ vs_opt = SelNE; eq[-1] = '\0'; opt = eq + 1; } else if (eq[-1] == ':') { /* := */ - vs_opt = VarAss; - eq[-1] = '\0'; - opt = eq + 1; + continue; } else if (eq[1] == '=') { /* == */ vs_opt = SelEQ; eq[0] = '\0'; @@ -549,6 +627,9 @@ eval_opts(char *opts, char *mapkey) vs_opt = SelNE; eq[0] = '\0'; opt = eq + 2; + } else { + /* old style assignment */ + continue; } /* @@ -559,48 +640,47 @@ eval_opts(char *opts, char *mapkey) * Check whether they match */ if (FSTREQ(op->name, f)) { - int selok; - switch (vs_opt) { - case SelEQ: - case SelNE: - if ((selok = (op->sel_p != NULL))) { - if (op->case_insensitive) { - selok = (STRCEQ(*op->sel_p, opt) == (vs_opt == SelNE)); - } else { - selok = (STREQ(*op->sel_p, opt) == (vs_opt == SelNE)); - } - } - if (selok) { + opt = expand_options(opt); + + if (op->sel_p != NULL) { + int selok; + if (op->case_insensitive) { + selok = STRCEQ(*op->sel_p, opt); + } else { + selok = STREQ(*op->sel_p, opt); + } + if (vs_opt == SelNE) + selok = !selok; + if (!selok) { plog(XLOG_MAP, "key %s: map selector %s (=%s) did not %smatch %s", mapkey, op->name, *op->sel_p, vs_opt == SelNE ? "mis" : "", opt); - return 0; + XFREE(opt); + goto out; } - /* check if to apply a function */ - if (op->fxn_p && - ((*op->fxn_p)(opt) == (vs_opt == SelNE))) { + XFREE(opt); + } + /* check if to apply a function */ + if (op->fxn_p) { + int funok; + + funok = op->fxn_p(opt); + if (vs_opt == SelNE) + funok = !funok; + if (!funok) { plog(XLOG_MAP, "key %s: map function %s did not %smatch %s", mapkey, op->name, vs_opt == SelNE ? "mis" : "", opt); - return 0; + XFREE(opt); + goto out; } - break; - - case VarAss: - if (op->sel_p) { - plog(XLOG_USER, "key %s: Can't assign to a selector (%s)", - mapkey, op->name); - return 0; - } - *op->optp = opt; - break; - - } /* end of "switch (vs_opt)" statement */ + XFREE(opt); + } break; /* break out of for loop */ } } @@ -609,7 +689,12 @@ eval_opts(char *opts, char *mapkey) plog(XLOG_USER, "key %s: Unrecognized key/option \"%s\"", mapkey, f); } - return 1; + /* all is ok */ + ret = 1; + + out: + free(old_o); + return ret; } @@ -717,9 +802,7 @@ strip_selectors(char *opts, char *mapkey) case VarAss: /* found the first assignment, return the string starting with it */ -#ifdef DEBUG dlog("found first assignment past selectors \"%s\"", o); -#endif /* DEBUG */ return oo; } } @@ -743,10 +826,7 @@ f_in_network(char *arg) return FALSE; status = is_network_member(arg); -#ifdef DEBUG - plog(XLOG_USER, "%s is %son a local network", - arg, (status ? "" : "not ")); -#endif /* DEBUG */ + dlog("%s is %son a local network", arg, (status ? "" : "not ")); return status; } @@ -758,9 +838,7 @@ f_netgrp(char *arg) int status; status = innetgr(arg, opt_host, NULL, NULL); -#ifdef DEBUG - plog(XLOG_USER, "netgrp = %s status = %d host = %s", arg, status, opt_host); -#endif /* DEBUG */ + dlog("netgrp = %s status = %d host = %s", arg, status, opt_host); return status; } @@ -772,9 +850,7 @@ f_netgrpd(char *arg) int status; status = innetgr(arg, opt_hostd, NULL, NULL); -#ifdef DEBUG - plog(XLOG_USER, "netgrp = %s status = %d hostd = %s", arg, status, opt_hostd); -#endif /* DEBUG */ + dlog("netgrp = %s status = %d hostd = %s", arg, status, opt_hostd); return status; } @@ -868,19 +944,17 @@ normalize_slash(char *p) * If sel is true then old expand selectors, otherwise * don't expand selectors. */ -static void -expand_op(opt_apply *p, int sel_p) +static char * +expand_op(char *opt, int sel_p) { static const char expand_error[] = "No space to expand \"%s\""; char expbuf[MAXPATHLEN + 1]; char nbuf[NLEN + 1]; char *ep = expbuf; - char *cp = *p->opt; + char *cp = opt; char *dp; struct opt *op; -#ifdef DEBUG - char *cp_orig = *p->opt; -#endif /* DEBUG */ + char *cp_orig = opt; while ((dp = strchr(cp, '$'))) { char ch; @@ -894,7 +968,7 @@ expand_op(opt_apply *p, int sel_p) strncpy(ep, cp, len); ep += len; } else { - plog(XLOG_ERROR, expand_error, *p->opt); + plog(XLOG_ERROR, expand_error, opt); goto out; } } @@ -905,7 +979,7 @@ expand_op(opt_apply *p, int sel_p) if (BUFSPACE(ep, 1)) { *ep++ = '$'; } else { - plog(XLOG_ERROR, expand_error, *p->opt); + plog(XLOG_ERROR, expand_error, opt); goto out; } } else if (ch == '{') { @@ -926,7 +1000,7 @@ expand_op(opt_apply *p, int sel_p) /* * Just give up */ - plog(XLOG_USER, "No closing '}' in \"%s\"", *p->opt); + plog(XLOG_USER, "No closing '}' in \"%s\"", opt); goto out; } len = br_p - cp; @@ -1073,7 +1147,7 @@ expand_op(opt_apply *p, int sel_p) strcpy(ep, vptr); ep += vlen; } else { - plog(XLOG_ERROR, expand_error, *p->opt); + plog(XLOG_ERROR, expand_error, opt); goto out; } } @@ -1102,13 +1176,11 @@ expand_op(opt_apply *p, int sel_p) strcpy(ep, env); ep += vlen; } else { - plog(XLOG_ERROR, expand_error, *p->opt); + plog(XLOG_ERROR, expand_error, opt); goto out; } -#ifdef DEBUG amuDebug(D_STR) plog(XLOG_DEBUG, "Environment gave \"%s\" -> \"%s\"", nbuf, env); -#endif /* DEBUG */ } else { plog(XLOG_USER, "Unknown sequence \"${%s}\"", nbuf); } @@ -1117,7 +1189,7 @@ expand_op(opt_apply *p, int sel_p) /* * Error, error */ - plog(XLOG_USER, "Unknown $ sequence in \"%s\"", *p->opt); + plog(XLOG_USER, "Unknown $ sequence in \"%s\"", opt); } } @@ -1125,8 +1197,8 @@ out: /* * Handle common case - no expansion */ - if (cp == *p->opt) { - *p->opt = strdup(cp); + if (cp == opt) { + opt = strdup(cp); } else { /* * Finish off the expansion @@ -1135,23 +1207,22 @@ out: strcpy(ep, cp); /* ep += strlen(ep); */ } else { - plog(XLOG_ERROR, expand_error, *p->opt); + plog(XLOG_ERROR, expand_error, opt); } /* * Save the expansion */ - *p->opt = strdup(expbuf); + opt = strdup(expbuf); } - normalize_slash(*p->opt); + normalize_slash(opt); -#ifdef DEBUG amuDebug(D_STR) { plog(XLOG_DEBUG, "Expansion of \"%s\"...", cp_orig); - plog(XLOG_DEBUG, "... is \"%s\"", *p->opt); + plog(XLOG_DEBUG, "......... is \"%s\"", opt); } -#endif /* DEBUG */ + return opt; } @@ -1162,15 +1233,15 @@ static void expand_opts(opt_apply *p, int sel_p) { if (*p->opt) { - expand_op(p, sel_p); + *p->opt = expand_op(*p->opt, sel_p); } else if (p->val) { /* * Do double expansion, remembering * to free the string from the first * expansion... */ - char *s = *p->opt = expand_key(p->val); - expand_op(p, sel_p); + char *s = expand_op(p->val, TRUE); + *p->opt = expand_op(s, sel_p); XFREE(s); } } @@ -1208,18 +1279,22 @@ free_opts(am_opts *fo) /* - * Expand lookup key + * Expand selectors (variables that cannot be assigned to or overridden) */ char * -expand_key(char *key) +expand_selectors(char *key) { - opt_apply oa; + return expand_op(key, TRUE); +} - oa.opt = &key; - oa.val = 0; - expand_opts(&oa, TRUE); - return key; +/* + * Expand options (i.e. non-selectors, see above for definition) + */ +static inline char * +expand_options(char *key) +{ + return expand_op(key, FALSE); } @@ -1278,24 +1353,27 @@ eval_fs_opts(am_opts *fo, char *opts, char *g_opts, char *path, char *key, char /* * Expand global options */ - fs_static.fs_glob = expand_key(g_opts); + fs_static.fs_glob = expand_selectors(g_opts); /* * Expand local options */ - fs_static.fs_local = expand_key(opts); + fs_static.fs_local = expand_selectors(opts); - /* - * Expand default (global) options - */ - if (!eval_opts(fs_static.fs_glob, key)) - ok = FALSE; - - /* - * Expand local options - */ - if (ok && !eval_opts(fs_static.fs_local, key)) - ok = FALSE; + /* break global options into fs_static fields */ + if ((ok = split_opts(fs_static.fs_glob, key))) { + dlog("global split_opts ok"); + /* + * evaluate local selectors + */ + if ((ok = eval_selectors(fs_static.fs_local, key))) { + dlog("local eval_selectors ok"); + /* if the local selectors matched, then do the local overrides */ + ok = split_opts(fs_static.fs_local, key); + if (ok) + dlog("local split_opts ok"); + } + } /* * Normalize remote host name. diff --git a/dist/am-utils/amd/sched.c b/dist/am-utils/amd/sched.c index 7fc6b47e6a29..50fa8b577fd1 100644 --- a/dist/am-utils/amd/sched.c +++ b/dist/am-utils/amd/sched.c @@ -1,7 +1,7 @@ -/* $NetBSD: sched.c,v 1.3 2001/05/13 18:06:57 veego Exp $ */ +/* $NetBSD: sched.c,v 1.4 2002/11/29 23:06:22 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: sched.c,v 1.4.2.2 2001/01/10 03:23:12 ezk Exp + * Id: sched.c,v 1.10 2002/02/02 20:58:56 ezk Exp * */ @@ -145,7 +144,7 @@ run_task(task_fun tf, voidp ta, cb_fun cf, voidp ca) return; } - /* child code runs here, parent have returned to caller */ + /* child code runs here, parent has returned to caller */ exit((*tf) (ta)); /* firewall... */ @@ -164,9 +163,7 @@ sched_task(cb_fun cf, voidp ca, voidp wchan) */ pjob *p = sched_job(cf, ca); -#ifdef DEBUG dlog("SLEEP on %#lx", (unsigned long) wchan); -#endif /* DEBUG */ p->wchan = wchan; p->pid = 0; memset((voidp) &p->w, 0, sizeof(p->w)); @@ -191,7 +188,7 @@ wakeup(voidp wchan) return; /* - * Can't user ITER() here because + * Can't use ITER() here because * wakeupjob() juggles the list. */ for (p = AM_FIRST(pjob, &proc_wait_list); @@ -263,11 +260,9 @@ sigchld(int sig) if (WIFSIGNALED(w)) plog(XLOG_ERROR, "Process %d exited with signal %d", pid, WTERMSIG(w)); -#ifdef DEBUG else dlog("Process %d exited with status %d", pid, WEXITSTATUS(w)); -#endif /* DEBUG */ for (p = AM_FIRST(pjob, &proc_wait_list); p2 = NEXT(pjob, p), p != HEAD(pjob, &proc_wait_list); @@ -279,10 +274,8 @@ sigchld(int sig) } } /* end of for loop */ -#ifdef DEBUG if (!p) dlog("can't locate task block for pid %d", pid); -#endif /* DEBUG */ /* * Must count down children inside the while loop, otherwise we won't diff --git a/dist/am-utils/amd/srvr_nfs.c b/dist/am-utils/amd/srvr_nfs.c index 28b321b2cc7b..b6a3332da002 100644 --- a/dist/am-utils/amd/srvr_nfs.c +++ b/dist/am-utils/amd/srvr_nfs.c @@ -1,7 +1,7 @@ -/* $NetBSD: srvr_nfs.c,v 1.5 2001/05/13 18:06:57 veego Exp $ */ +/* $NetBSD: srvr_nfs.c,v 1.6 2002/11/29 23:06:22 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: srvr_nfs.c,v 1.7.2.5 2001/04/14 21:08:23 ezk Exp + * Id: srvr_nfs.c,v 1.18 2002/06/23 01:05:39 ib42 Exp * */ @@ -194,9 +193,7 @@ got_portmap(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in *ia, nfs_private *np = (nfs_private *) fs->fs_private; if (!error && port) { -#ifdef DEBUG dlog("got port (%d) for mountd on %s", (int) port, fs->fs_host); -#endif /* DEBUG */ /* * Grab the port number. Portmap sends back * an u_long in native ordering, so it @@ -207,10 +204,8 @@ got_portmap(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in *ia, np->np_mountd_inval = FALSE; np->np_error = 0; } else { -#ifdef DEBUG dlog("Error fetching port for mountd on %s", fs->fs_host); dlog("\t error=%d, port=%d", error, (int) port); -#endif /* DEBUG */ /* * Almost certainly no mountd running on remote host */ @@ -220,13 +215,9 @@ got_portmap(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in *ia, if (fs->fs_flags & FSF_WANT) wakeup_srvr(fs); } else if (done) { -#ifdef DEBUG dlog("Got portmap for old port request"); -#endif /* DEBUG */ } else { -#ifdef DEBUG dlog("portmap request timed out"); -#endif /* DEBUG */ } } @@ -313,9 +304,7 @@ nfs_pinged(voidp pkt, int len, struct sockaddr_in *sp, struct sockaddr_in *tsp, { int xid = (long) idv; /* for 64-bit archs */ fserver *fs; -#ifdef DEBUG int found_map = 0; -#endif /* DEBUG */ if (!done) return; @@ -338,19 +327,15 @@ nfs_pinged(voidp pkt, int len, struct sockaddr_in *sp, struct sockaddr_in *tsp, } else { if (np->np_ping > 1) srvrlog(fs, "ok"); -#ifdef DEBUG else srvrlog(fs, "starts up"); -#endif /* DEBUG */ fs->fs_flags |= FSF_VALID; } map_flush_srvr(fs); } else { if (fs->fs_flags & FSF_VALID) { -#ifdef DEBUG dlog("file server %s type nfs is still up", fs->fs_host); -#endif /* DEBUG */ } else { if (np->np_ping > 1) srvrlog(fs, "ok"); @@ -386,17 +371,13 @@ nfs_pinged(voidp pkt, int len, struct sockaddr_in *sp, struct sockaddr_in *tsp, if (np->np_mountd_inval) recompute_portmap(fs); -#ifdef DEBUG found_map++; -#endif /* DEBUG */ break; } } -#ifdef DEBUG if (found_map == 0) dlog("Spurious ping packet"); -#endif /* DEBUG */ } @@ -445,19 +426,15 @@ nfs_timed_out(voidp v) /* * Known to be down */ -#ifdef DEBUG if ((fs->fs_flags & FSF_VALID) == 0) srvrlog(fs, "starts down"); -#endif /* DEBUG */ fs->fs_flags |= FSF_VALID; } if (oflags != fs->fs_flags && (fs->fs_flags & FSF_WANT)) wakeup_srvr(fs); } else { -#ifdef DEBUG if (np->np_ping > 1) dlog("%d pings to %s failed - at most %d allowed", np->np_ping, fs->fs_host, MAX_ALLOWED_PINGS); -#endif /* DEBUG */ } /* @@ -515,9 +492,7 @@ nfs_keepalive(voidp v) break; case 0: -#ifdef DEBUG dlog("Sent NFS ping to %s", fs->fs_host); -#endif /* DEBUG */ break; } @@ -540,9 +515,7 @@ nfs_keepalive(voidp v) break; } -#ifdef DEBUG dlog("NFS timeout in %d seconds", fstimeo); -#endif /* DEBUG */ fs->fs_cid = timeout(fstimeo, nfs_timed_out, (voidp) fs); } @@ -608,9 +581,7 @@ start_nfs_pings(fserver *fs, int pingval) nfs_keepalive(fs); } } else { -#ifdef DEBUG dlog("Already running pings to %s", fs->fs_host); -#endif /* DEBUG */ } } @@ -642,49 +613,60 @@ find_nfs_srvr(mntfs *mf) mnt.mnt_opts = mf->mf_mopts; pingval = hasmntval(&mnt, "ping"); - /* - * Get the NFS version from the mount options. This is used - * to decide the highest NFS version to try. - */ + if (mf->mf_flags & MFF_NFS_SCALEDOWN) { + /* + * the server granted us a filehandle, but we were unable to mount it. + * therefore, scale down to NFSv2/UDP and try again. + */ + nfs_version = (u_long) 2; + nfs_proto = "udp"; + plog(XLOG_WARNING, "find_nfs_srvr: NFS mount failed, trying again with NFSv2/UDP"); + mf->mf_flags &= ~MFF_NFS_SCALEDOWN; + } else { + /* + * Get the NFS version from the mount options. This is used + * to decide the highest NFS version to try. + */ #ifdef MNTTAB_OPT_VERS - nfs_version = hasmntval(&mnt, MNTTAB_OPT_VERS); + nfs_version = hasmntval(&mnt, MNTTAB_OPT_VERS); #endif /* MNTTAB_OPT_VERS */ #ifdef MNTTAB_OPT_PROTO - { - char *proto_opt = hasmnteq(&mnt, MNTTAB_OPT_PROTO); - if (proto_opt) { - char **p; - for (p = protocols; *p; p ++) - if (NSTREQ(proto_opt, *p, strlen(*p))) { - nfs_proto = *p; - break; - } - if (*p == NULL) - plog(XLOG_WARNING, "ignoring unknown protocol option for %s:%s", - host, rfsname); + { + char *proto_opt = hasmnteq(&mnt, MNTTAB_OPT_PROTO); + if (proto_opt) { + char **p; + for (p = protocols; *p; p ++) + if (NSTREQ(proto_opt, *p, strlen(*p))) { + nfs_proto = *p; + break; + } + if (*p == NULL) + plog(XLOG_WARNING, "ignoring unknown protocol option for %s:%s", + host, rfsname); + } } - } #endif /* MNTTAB_OPT_PROTO */ #ifdef HAVE_NFS_NFSV2_H - /* allow overriding if nfsv2 option is specified in mount options */ - if (hasmntopt(&mnt, "nfsv2")) { - nfs_version = (u_long) 2; /* nullify any ``vers=X'' statements */ - nfs_proto = "udp"; /* nullify any ``proto=tcp'' statements */ - plog(XLOG_WARNING, "found compatiblity option \"nfsv2\": set options vers=2,proto=udp for host %s", host); - } + /* allow overriding if nfsv2 option is specified in mount options */ + if (hasmntopt(&mnt, "nfsv2")) { + nfs_version = (u_long) 2; /* nullify any ``vers=X'' statements */ + nfs_proto = "udp"; /* nullify any ``proto=tcp'' statements */ + plog(XLOG_WARNING, "found compatiblity option \"nfsv2\": set options vers=2,proto=udp for host %s", host); + } #endif /* HAVE_NFS_NFSV2_H */ - /* check if we globally overridden the NFS version/protocol */ - if (gopt.nfs_vers) { - nfs_version = gopt.nfs_vers; - plog(XLOG_INFO, "find_nfs_srvr: force NFS version to %d", - (int) nfs_version); - } - if (gopt.nfs_proto) { - nfs_proto = gopt.nfs_proto; - plog(XLOG_INFO, "find_nfs_srvr: force NFS protocol transport to %s", nfs_proto); + /* check if we globally overridden the NFS version/protocol */ + if (gopt.nfs_vers) { + nfs_version = gopt.nfs_vers; + plog(XLOG_INFO, "find_nfs_srvr: force NFS version to %d", + (int) nfs_version); + } + if (gopt.nfs_proto) { + nfs_proto = gopt.nfs_proto; + plog(XLOG_INFO, "find_nfs_srvr: force NFS protocol transport to %s", nfs_proto); + } } /* diff --git a/dist/am-utils/amq/amq.8 b/dist/am-utils/amq/amq.8 index f40ffe35b694..35f8ef17ad1b 100644 --- a/dist/am-utils/amq/amq.8 +++ b/dist/am-utils/amq/amq.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: amq.8,v 1.2 2001/12/18 09:31:48 wiz Exp $ +.\" $NetBSD: amq.8,v 1.3 2002/11/29 23:06:23 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -40,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" Id: amq.8,v 1.3.2.4 2001/01/12 22:43:43 ro Exp +.\" Id: amq.8,v 1.9 2002/01/07 07:36:21 ezk Exp .\" .TH AMQ 8 "25 April 1989" .SH NAME @@ -85,7 +85,7 @@ information is displayed. .TP .B \-f -Ask the automounter to flush the internal caches. +Ask the automounter to flush the internal caches and reload all the maps. .TP .BI \-h " hostname" diff --git a/dist/am-utils/amq/amq.c b/dist/am-utils/amq/amq.c index 06ae6da6e3ac..b5f9d092bccd 100644 --- a/dist/am-utils/amq/amq.c +++ b/dist/am-utils/amq/amq.c @@ -1,7 +1,7 @@ -/* $NetBSD: amq.c,v 1.3 2001/07/14 06:01:22 mrg Exp $ */ +/* $NetBSD: amq.c,v 1.4 2002/11/29 23:06:23 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: amq.c,v 1.7.2.5 2001/01/12 22:43:43 ro Exp + * Id: amq.c,v 1.14 2002/02/02 20:58:56 ezk Exp * */ @@ -50,14 +49,13 @@ #ifndef lint char copyright[] = "\ -@(#)Copyright (c) 1997-2001 Erez Zadok\n\ +@(#)Copyright (c) 1997-2002 Erez Zadok\n\ @(#)Copyright (c) 1990 Jan-Simon Pendry\n\ @(#)Copyright (c) 1990 Imperial College of Science, Technology & Medicine\n\ @(#)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.7.2.5 2001/01/12 22:43:43 ro Exp"; -static char sccsid[] = "%W% (Berkeley) %G%"; +static char rcsid[] = "Id: amq.c,v 1.14 2002/02/02 20:58:56 ezk Exp"; #endif /* __GNUC__ < 2 */ #endif /* not lint */ @@ -118,7 +116,7 @@ show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, int *twid) case Full: { struct tm *tp = localtime((time_t *) &mt->mt_mounttime); - printf("%-*.*s %-*.*s %-*.*s %s\n\t%-5d %-7d %-6d %-7d %-7d %-6d %02d/%02d/%02d %02d:%02d:%02d\n", + printf("%-*.*s %-*.*s %-*.*s %s\n\t%-5d %-7d %-6d %-7d %-7d %-6d %02d/%02d/%04d %02d:%02d:%02d\n", *dwid, *dwid, *mt->mt_directory ? mt->mt_directory : "/", /* XXX */ *twid, *twid, @@ -134,8 +132,8 @@ show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, int *twid) mt->mt_readlink, mt->mt_statfs, - tp->tm_year > 99 ? tp->tm_year - 100 : tp->tm_year, tp->tm_mon + 1, tp->tm_mday, + tp->tm_year < 1900 ? tp->tm_year + 1900 : tp->tm_year, tp->tm_hour, tp->tm_min, tp->tm_sec); } break; @@ -143,7 +141,7 @@ show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, int *twid) case Stats: { struct tm *tp = localtime((time_t *) &mt->mt_mounttime); - printf("%-*.*s %-5d %-7d %-6d %-7d %-7d %-6d %02d/%02d/%02d %02d:%02d:%02d\n", + printf("%-*.*s %-5d %-7d %-6d %-7d %-7d %-6d %02d/%02d/%02d %02d:%02d:%04d\n", *dwid, *dwid, *mt->mt_directory ? mt->mt_directory : "/", /* XXX */ @@ -154,8 +152,8 @@ show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, int *twid) mt->mt_readlink, mt->mt_statfs, - tp->tm_year > 99 ? tp->tm_year - 100 : tp->tm_year, tp->tm_mon + 1, tp->tm_mday, + tp->tm_year < 1900 ? tp->tm_year + 1900 : tp->tm_year, tp->tm_hour, tp->tm_min, tp->tm_sec); } break; diff --git a/dist/am-utils/amq/pawd.1 b/dist/am-utils/amq/pawd.1 index 74c8809af811..de9b8ae491c4 100644 --- a/dist/am-utils/amq/pawd.1 +++ b/dist/am-utils/amq/pawd.1 @@ -1,7 +1,7 @@ -.\" $NetBSD: pawd.1,v 1.2 2001/12/18 09:31:48 wiz Exp $ +.\" $NetBSD: pawd.1,v 1.3 2002/11/29 23:06:23 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -40,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" Id: pawd.1,v 1.3.2.1 2001/01/10 03:23:14 ezk Exp +.\" Id: pawd.1,v 1.5 2002/01/07 07:36:21 ezk Exp .\" .TH PAWD 1 "6 Jan 1998" .SH NAME diff --git a/dist/am-utils/conf/transp/transp_sockets.c b/dist/am-utils/conf/transp/transp_sockets.c index 01201df63bee..812549fff3e4 100644 --- a/dist/am-utils/conf/transp/transp_sockets.c +++ b/dist/am-utils/conf/transp/transp_sockets.c @@ -1,7 +1,7 @@ -/* $NetBSD: transp_sockets.c,v 1.2 2002/11/08 00:14:50 fvdl Exp $ */ +/* $NetBSD: transp_sockets.c,v 1.3 2002/11/29 23:06:23 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: transp_sockets.c,v 1.6.2.3 2001/04/14 21:08:24 ezk Exp + * Id: transp_sockets.c,v 1.15 2002/06/23 01:05:39 ib42 Exp * * Socket specific utilities. * -Erez Zadok @@ -166,9 +165,7 @@ get_mount_client(char *unused_host, struct sockaddr_in *sin, struct timeval *tv, *sock = RPC_ANYSOCK; return NULL; } -#ifdef DEBUG dlog("get_mount_client: Using udp, port %d", sin->sin_port); -#endif /* DEBUG */ return client; } @@ -184,6 +181,16 @@ amu_svc_getcaller(SVCXPRT *xprt) } +/* + * register an RPC server + */ +int +amu_svc_register(SVCXPRT *xprt, u_long prognum, u_long versnum, void (*dispatch)(), u_long protocol, struct netconfig *dummy) +{ + return svc_register(xprt, prognum, versnum, dispatch, protocol); +} + + /* * Create the nfs service for amd */ @@ -206,7 +213,8 @@ create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (* return 1; } if (!svc_register(*nfs_xprtp, NFS_PROGRAM, NFS_VERSION, dispatch_fxn, 0)) { - plog(XLOG_FATAL, "unable to register (%d, %d, 0)", NFS_PROGRAM, NFS_VERSION); + plog(XLOG_FATAL, "unable to register (%ld, %ld, 0)", + (u_long) NFS_PROGRAM, (u_long) NFS_VERSION); return 3; } @@ -218,7 +226,7 @@ create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (* * Create the amq service for amd (both TCP and UDP) */ int -create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp) +create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, struct netconfig **dummy1, int *tcp_soAMQp, SVCXPRT **tcp_amqpp, struct netconfig **dummy2) { int maxrec = RPC_MAXDATASIZE; @@ -379,19 +387,3 @@ try_again: (int) nfs_version, proto, host); return nfs_version; } - - -/* - * AUTOFS FUNCTIONS FOR SOCKETS: - */ -#ifdef HAVE_FS_AUTOFS -/* - * Create the nfs service for amd - */ -int -create_autofs_service(int *soAUTOFSp, u_short *autofs_portp, SVCXPRT **autofs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp)) -{ - /* NOT IMPLEMENTED! */ - return -1; -} -#endif /* HAVE_FS_AUTOFS */ diff --git a/dist/am-utils/doc/am-utils.texi b/dist/am-utils/doc/am-utils.texi index d429938328d9..a539f29c3e0f 100644 --- a/dist/am-utils/doc/am-utils.texi +++ b/dist/am-utils/doc/am-utils.texi @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- -@c $NetBSD: am-utils.texi,v 1.3 2001/05/13 18:06:59 veego Exp $ +@c $NetBSD: am-utils.texi,v 1.4 2002/11/29 23:06:24 christos Exp $ @c -@c Copyright (c) 1997-2001 Erez Zadok +@c Copyright (c) 1997-2002 Erez Zadok @c Copyright (c) 1989 Jan-Simon Pendry @c Copyright (c) 1989 Imperial College of Science, Technology & Medicine @c Copyright (c) 1989 The Regents of the University of California. @@ -39,13 +39,14 @@ @c @c %W% (Berkeley) %G% @c -@c Id: am-utils.texi,v 1.21.2.16 2001/04/07 00:47:43 ib42 Exp +@c Id: am-utils.texi,v 1.49 2002/06/23 00:57:38 ezk Exp @c @setfilename am-utils.info @include version.texi @c info directory entry +@dircategory Administration @direntry * Am-utils: (am-utils). The Amd automounter suite of utilities @end direntry @@ -61,7 +62,7 @@ (Originally by Jan-Simon Pendry and Nick Williams) @page -Copyright @copyright{} 1997-2001 Erez Zadok +Copyright @copyright{} 1997-2002 Erez Zadok @* Copyright @copyright{} 1989 Jan-Simon Pendry @* @@ -86,6 +87,7 @@ copyright notice and statement of permission are included. @c ################################################################ @node Top, License, , (DIR) Am-utils - The 4.4BSD Automounter Tool Suite + ********************************************* Am-utils is the 4.4BSD Automounter Tool Suite, which includes the Amd @@ -223,7 +225,7 @@ part of his @uref{http://www.cs.columbia.edu/~ezk/research/tp/thesis_proposal.ht Before reporting a bug, see if it is a known one in the @uref{http://www.am-utils.org/BUGS.txt,bugs} file. -Send all bug reports to @email{amd-dev@@majordomo.cs.columbia.edu} +Send all bug reports to @email{amd-dev@@am-utils.org} quoting the details of the release and your configuration. These can be obtained by running the command @samp{amd -v}. It would greatly help if you could provide a reproducible procedure for detecting the bug you are @@ -340,14 +342,21 @@ on am-utils. Am-utils version 6.0 was numbered with a major new release number to distinguish it from the last official release of @i{Amd} (5.x). Many new features have been added such as a GNU @code{configure} system, NFS -Version 3, Autofs support, a run-time configuration file (`amd.conf'), -many new ports, more scripts and programs, as well as numerous bug -fixes. Another reason for the new major release number was to alert -users of am-utils that user-visible interfaces may have changed. In -order to make @i{Amd} work well for the next 10 years, and be easier to -maintain, it was necessary to remove old or unused features, change -various syntax files, etc. However, great care was taken to ensure the -maximum possible backwards compatibility. +Version 3, a run-time configuration file (`amd.conf'), many new ports, +more scripts and programs, as well as numerous bug fixes. Another +reason for the new major release number was to alert users of am-utils +that user-visible interfaces may have changed. In order to make @i{Amd} +work well for the next 10 years, and be easier to maintain, it was +necessary to remove old or unused features, change various syntax files, +etc. However, great care was taken to ensure the maximum possible +backwards compatibility. + +Am-utils version 6.1 has autofs support for Linux and Solaris 2.5+ as +_the_ major new feature, in addition to several other minor new +features. The autofs support is completely transparent to the end-user, +aside from the fact that /bin/pwd now always returns the correct +amd-ified path. The administrator can easily switch between NFS and +autofs mounts by changing one parameter in amd.conf. @c ################################################################ @node Overview, Supported Platforms, History, Top @@ -710,11 +719,7 @@ features. @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab yes @tab yes @tab ? -@item @b{alphaev5-unknown-linux-gnu} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{alphaev5-unknown-linux-gnu-rh5.2} +@item @b{alphaev5-unknown-linux-rh5.2} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? @@ -778,6 +783,10 @@ features. @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab yes @tab yes @tab ? +@item @b{i386-pc-linux-rh7.2} +@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} +@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes + @item @b{i386-pc-solaris2.5.1} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab yes @tab yes @tab yes @@ -814,7 +823,11 @@ features. @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab yes @tab yes @tab ? -@item @b{i386-unknown-freebsd4.2} +@item @b{i386-unknown-freebsd4.4} +@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} +@tab yes @tab yes @tab yes @tab yes @tab yes @tab ? + +@item @b{i386-unknown-freebsd5.0} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab yes @tab yes @tab ? @@ -894,73 +907,53 @@ features. @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab ? @tab yes @tab yes @tab ? -@item @b{i486-pc-linux-gnu-rh6.0} +@item @b{i386-pc-linux} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? -@item @b{i486-pc-linux-gnulibc1} +@item @b{i386-pc-linux-rh5.2} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? -@item @b{i486-pc-linux-gnulibc1-rh4.2} +@item @b{i386-pc-linux-rh6.0} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? -@item @b{i486-pc-linux-gnuoldld} +@item @b{i386-pc-linux-rh6.1} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? -@item @b{i586-pc-linux-gnu} +@item @b{i386-pc-linux-rh6.2} +@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} +@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes + +@item @b{i386-pc-linux-rh7.0} +@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} +@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes + +@item @b{i386-pc-linux-rh7.1} +@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} +@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes + +@item @b{i386-pc-linux-gnulibc1} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? -@item @b{i586-pc-linux-gnu-rh5.2} +@item @b{i386-pc-linux-gnulibc1-rh4.2} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? -@item @b{i586-pc-linux-gnu-rh6.0} +@item @b{i386-pc-linux-gnuoldld} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? -@item @b{i586-pc-linux-gnu-rh6.1} +@item @b{ia64-hp-hpux11.20} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? +@tab yes @tab yes @tab yes @tab yes @tab yes @tab ? -@item @b{i586-pc-linux-gnu-rh6.2} +@item @b{ia64-unknown-linux-rh7.1} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{i586-pc-linux-gnulibc1} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{i586-pc-linux-gnulibc1-rh4.2} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{i686-pc-linux-gnu} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{i686-pc-linux-gnu-rh5.2} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{i686-pc-linux-gnu-rh6.0} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{i686-pc-linux-gnu-rh6.2} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab yes - -@item @b{i686-pc-linux-gnulibc} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? - -@item @b{i686-pc-linux-gnulibc1} -@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? +@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes @item @b{m68k-hp-hpux9.00} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @@ -996,7 +989,7 @@ features. @item @b{mips-sgi-irix6.5} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} -@tab yes @tab yes @tab yes @tab yes @tab yes @tab ? +@tab yes @tab yes @tab yes @tab yes @tab yes @tab ? @item @b{powerpc-ibm-aix4.1.5.0} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @@ -1010,7 +1003,7 @@ features. @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab ? @tab yes @tab ? @tab ? -@item @b{powerpc-unknown-linux-gnu} +@item @b{powerpc-unknown-linux} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? @@ -1082,6 +1075,10 @@ features. @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab n/a @tab yes @tab ? +@item @b{sparc64-unknown-linux-rh6.2} +@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} +@tab yes @tab yes @tab yes @tab yes @tab yes @tab ? + @item @b{sparc-unknown-netbsd1.2E} @c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd} @tab yes @tab yes @tab yes @tab ? @tab ? @tab ? @@ -1718,7 +1715,8 @@ The following selectors are currently implemented. The machine architecture which was automatically determined at compile time. The architecture type can be displayed by running the command -@samp{amd -v}. @xref{Supported Platforms}.@refill +@samp{amd -v}. You can override this value also using the @code{-A} +command line option. @xref{Supported Platforms}.@refill @c ---------------------------------------------------------------- @node autodir Selector Variable, byte Selector Variable, arch Selector Variable, Selectors @@ -2114,9 +2112,18 @@ function (@pxref{netgrp Selector Function}) uses short host names @cindex Mount selector; in_network @cindex Selector; in_network -If the current host has any network interface that is locally attached -to the network specified in @i{ARG} (either via name or number), this -selector evaluates to true. Otherwise it evaluates to false. +This selector matches against any network name or number with an +optional netmask. First, if the current host has any network interface that is +locally attached to the network specified in @i{ARG} (either via name or +number), this selector evaluates to true. + +Second, @samp{in_network} supports a network/netmask syntax such as +@samp{128.59.16.0/255.255.255.0}, @samp{128.59.16.0/24}, +@samp{128.59.16.0/0xffffff00}, or @samp{128.59.16.0/}. Using the last +form, @i{Amd} will match the specified network number against the +default netmasks of each of the locally attached interfaces. + +If the selector does not match, it evaluates to false. For example, suppose you have two servers that have an exportable @file{/opt} that smaller clients can NFS mount. The two servers are @@ -2374,6 +2381,16 @@ Allow keyboard interrupts on hard mounts. @cindex Mount flags; lock Use the NFS locking protocol (default) +@item loop +@cindex Mount flags; loop +Support loop device mounts for CDFS (currently only on Linux). With +this option, you can mount ISO-9660 files as if they were normal +CD-ROMs: + +@example +sw71 type:=cdfs;addopts:=loop;dev:=/misc/rh71cd.iso;rfs:=/mnt/RPMS +@end example + @item multi @cindex Mount flags; multi Perform multi-component lookup on files. @@ -2598,6 +2615,10 @@ has failed. In fact the interval is extended before the unmount is attempted to avoid thrashing. The default value is 120 seconds (two minutes) or as set by the @code{-w} command line option. +@item xlatecookie +@cindex Mount flags; xlatecookie +Translate directory cookies between 32-long and 64-long lengths. + @end table @node remopts Option, sublink Option, opts Option, Map Options @@ -2709,6 +2730,7 @@ exists. * -w Option:: Wait interval after failed unmount. * -x Option:: Log options. * -y Option:: NIS domain. +* -A-Option:: Operating system Architecture. * -C-Option:: Cluster name. * -D-Option:: Debug flags. * -F Option:: Amd configuration file. @@ -3067,7 +3089,7 @@ If @i{Amd} was built with debugging enabled the @code{debug} option is automatically enabled regardless of the command line options. @c ---------------------------------------------------------------- -@node -y Option, -C-Option, -x Option, Amd Command Line Options +@node -y Option, -A-Option, -x Option, Amd Command Line Options @comment node-name, next, previous, up @section @code{-y} @var{NIS-domain} @cindex NIS (YP) domain name @@ -3082,7 +3104,22 @@ immediately attempts to bind to a server for this domain. @c is specified, and whenever required in a mount map. @c ---------------------------------------------------------------- -@node -C-Option, -D-Option, -y Option, Amd Command Line Options +@node -A-Option, -C-Option, -y Option, Amd Command Line Options +@comment node-name, next, previous, up +@section @code{-A} @var{architecture} +@cindex Setting the operating system architecture + +Specifies the OS architecture of the system. +The only effect of this option is to set the variable @code{$@{arch@}}. + +This option would be used as follows: + +@example +amd -A i386 ... +@end example + +@c ---------------------------------------------------------------- +@node -C-Option, -D-Option, -A-Option, Amd Command Line Options @comment node-name, next, previous, up @section @code{-C} @var{cluster-name} @cindex Cluster names @@ -3135,7 +3172,7 @@ program trace print high resolution time stamps (only if @b{syslog}(3) is not used) @item info @cindex debugging hesiod resolver service -@cindex Hesiod: turning on RES_DEBUG +@cindex Hesiod; turning on RES_DEBUG info service specific debugging (hesiod, nis, etc.) In the case of hesiod maps, turns on the hesiod RES_DEBUG internal debugging option. @item mem @@ -3202,10 +3239,12 @@ older maps which were written with the latter in mind. @comment node-name, next, previous, up @section @code{-S} @cindex plock; using +@cindex mlockall; using @cindex locking executable pages in memory Do @emph{not} lock the running executable pages of @i{Amd} into memory. To improve @i{Amd}'s performance, systems that support the @b{plock}(3) +or @b{mlockall}(2) call lock the @i{Amd} process into memory. This way there is less chance the operating system will schedule, page out, and swap the @i{Amd} process as needed. This tends to improve @i{Amd}'s performance, @@ -3274,7 +3313,6 @@ effect visible to the user.@refill * Union Filesystem:: * Error Filesystem:: * Top-level Filesystem:: -* Autofs Filesystem:: Sun's kernel-based automounter filesystem. * Root Filesystem:: * Inheritance Filesystem:: @end menu @@ -4101,7 +4139,7 @@ directory''. All other operations trivially succeed. The error filesystem is not directly accessible. @c ---------------------------------------------------------------- -@node Top-level Filesystem, Autofs Filesystem, Error Filesystem, Filesystem Types +@node Top-level Filesystem, Root Filesystem, Error Filesystem, Filesystem Types @comment node-name, next, previous, up @section Top-level Filesystem (@samp{toplvl}) @cindex Top level filesystem @@ -4113,7 +4151,7 @@ and is used to mount the top-level automount nodes. Requests of this type are automatically generated from the command line arguments. @c ---------------------------------------------------------------- -@node Root Filesystem, Inheritance Filesystem, Autofs Filesystem, Filesystem Types +@node Root Filesystem, Inheritance Filesystem, Top-level Filesystem, Filesystem Types @comment node-name, next, previous, up @section Root Filesystem (@samp{root}) @cindex Root filesystem @@ -4128,24 +4166,6 @@ undefined. The root filesystem is not directly accessible. -@c ---------------------------------------------------------------- -@node Autofs Filesystem, Root Filesystem, Top-level Filesystem, Filesystem Types -@comment node-name, next, previous, up -@section Autofs Filesystem (@samp{autofs}) -@cindex Autofs filesystem -@cindex autofs, filesystem type -@cindex Filesystem type; autofs - -The @dfn{autofs} (@samp{type:=autofs}) filesystem uses Sun's kernel-based automounter -supporting filesystem for @i{Amd}'s mount points. Hence it is another -type of top level filesystem. - -The autofs filesystem is not directly accessible from @i{Amd} maps, but -only from the @file{amd.conf} file (@pxref{mount_type Parameter}). - -Note that Autofs support is still very early. See the distribution file -@file{README.autofs} for detail of what works and what does not. - @c ---------------------------------------------------------------- @node Inheritance Filesystem, , Root Filesystem, Filesystem Types @comment node-name, next, previous, up @@ -4376,6 +4396,8 @@ The following parameters are applicable to the @samp{[global]} section only. * local_domain Parameter:: * log_file Parameter:: * log_options Parameter:: +* map_reload_interval Parameter:: +* nfs_proto Parameter:: * nfs_proto Parameter:: * nfs_retransmit_counter Parameter:: * nfs_retry_interval Parameter:: @@ -4402,8 +4424,9 @@ The following parameters are applicable to the @samp{[global]} section only. @subsection @t{arch} Parameter @cindex arch Parameter -(type=string, default to compiled in value). Allows you to override the -value of the @i{arch} @i{Amd} variable. +(type=string, default to compiled in value). Same as the @code{-A} +option to @i{Amd}. Allows you to override the value of the @i{arch} +@i{Amd} variable. @c ---------------------------------------------------------------- @node auto_dir Parameter, cache_duration Parameter, arch Parameter, Global Parameters @@ -4604,7 +4627,7 @@ is generally a bad idea to use those reserved for other services such as @samp{kern}, @samp{lpr}, @samp{cron}, etc. @c ---------------------------------------------------------------- -@node log_options Parameter, nfs_proto Parameter, log_file Parameter, Global Parameters +@node log_options Parameter, map_reload_interval Parameter, log_file Parameter, Global Parameters @comment node-name, next, previous, up @subsection @t{log_options} Parameter @cindex log_options Parameter @@ -4641,7 +4664,18 @@ warnings @end table @c ---------------------------------------------------------------- -@node nfs_proto Parameter, nfs_retransmit_counter Parameter, log_options Parameter, Global Parameters +@node map_reload_interval Parameter, nfs_proto Parameter, log_options Parameter, Global Parameters +@comment node-name, next, previous, up +@subsection @t{map_reload_interval} Parameter +@cindex map_reload_interval Parameter + +(type=numeric, default=3600). The number of seconds that @i{Amd} will +wait before it checks to see if any maps have changed at their source +(NIS servers, LDAP servers, files, etc.). @i{Amd} will reload only +those maps that have changed. + +@c ---------------------------------------------------------------- +@node nfs_proto Parameter, nfs_retransmit_counter Parameter, map_reload_interval Parameter, Global Parameters @comment node-name, next, previous, up @subsection @t{nfs_proto} Parameter @cindex nfs_proto Parameter @@ -4770,6 +4804,7 @@ This file is used only if the @samp{print_pid} option is on (type=boolean, default=@samp{yes}). Same as the @code{-S} option to @i{Amd}. If @samp{yes}, lock the running executable pages of @i{Amd} into memory. To improve @i{Amd}'s performance, systems that support the @b{plock}(3) +or @b{mlockall}(2) call can lock the @i{Amd} process into memory. This way there is less chance the operating system will schedule, page out, and swap the @i{Amd} process as needed. This improves @i{Amd}'s performance, at the @@ -5473,7 +5508,7 @@ The purpose of @i{FSinfo} is to generate all the important standard filesystem data files from a single set of input data. Starting with a single data source guarantees that all the generated files are self-consistent. One of the possible output data formats is a set of -@i{Amd} maps which can be used amongst the set of hosts described in the +@i{Amd} maps which can be used among the set of hosts described in the input data. @i{FSinfo} implements a declarative language. This language is @@ -5654,14 +5689,14 @@ host @{ The options that can be given as host attributes are shown below. @menu -* netif Option: FSinfo host netif: -* config Option: FSinfo host config: -* arch Option: FSinfo host arch: -* os Option: FSinfo host os: -* cluster Option: FSinfo host cluster: +* FSinfo netif Option:: FSinfo host netif. +* FSinfo config Option:: FSinfo host config. +* FSinfo arch Option:: FSinfo host arch. +* FSinfo os Option:: FSinfo host os. +* FSinfo cluster Option:: FSinfo host cluster. @end menu -@node FSinfo host netif, FSinfo host config, , FSinfo host attributes +@node FSinfo netif Option, FSinfo config Option, , FSinfo host attributes @comment node-name, next, previous, up @subsection netif Option @@ -5692,7 +5727,7 @@ netif ie0 @{ netif ec0 @{ @} @end example -@node FSinfo host config, FSinfo host arch, FSinfo host netif, FSinfo host attributes +@node FSinfo config Option, FSinfo arch Option, FSinfo netif Option, FSinfo host attributes @comment node-name, next, previous, up @subsection config Option @cindex FSinfo config host attribute @@ -5711,7 +5746,7 @@ config "ZEPHYR=true" This option is currently unsupported. -@node FSinfo host arch, FSinfo host os, FSinfo host config, FSinfo host attributes +@node FSinfo arch Option, FSinfo os Option, FSinfo config Option, FSinfo host attributes @comment node-name, next, previous, up @subsection arch Option @cindex FSinfo arch host attribute @@ -5726,7 +5761,7 @@ arch = hp300 This is intended to be of use when building architecture specific mountmaps, however, the option is currently unsupported. -@node FSinfo host os, FSinfo host cluster, FSinfo host arch, FSinfo host attributes +@node FSinfo os Option, FSinfo cluster Option, FSinfo arch Option, FSinfo host attributes @comment node-name, next, previous, up @subsection os Option @cindex FSinfo os host attribute @@ -5742,7 +5777,7 @@ This information is used when creating the @file{fstab} files, for example in choosing which format to use for the @file{fstab} entries within the file. -@node FSinfo host cluster, , FSinfo host os, FSinfo host attributes +@node FSinfo cluster Option, , FSinfo os Option, FSinfo host attributes @comment node-name, next, previous, up @subsection cluster Option @cindex FSinfo cluster host attribute @@ -5853,16 +5888,16 @@ fs /dev/dsk/5s0 @{ @end example @menu -* fstype Option: FSinfo filesystems fstype: -* opts Option: FSinfo filesystems opts: -* passno Option: FSinfo filesystems passno: -* freq Option: FSinfo filesystems freq: -* mount Option: FSinfo filesystems mount: -* dumpset Option: FSinfo filesystems dumpset: -* log Option: FSinfo filesystems log: +* FSinfo fstype Option:: FSinfo filesystems fstype. +* FSinfo opts Option:: FSinfo filesystems opts. +* FSinfo passno Option:: FSinfo filesystems passno. +* FSinfo freq Option:: FSinfo filesystems freq. +* FSinfo mount Option:: FSinfo filesystems mount. +* FSinfo dumpset Option:: FSinfo filesystems dumpset. +* FSinfo log Option:: FSinfo filesystems log. @end menu -@node FSinfo filesystems fstype, FSinfo filesystems opts, , FSinfo filesystems +@node FSinfo fstype Option, FSinfo opts Option, , FSinfo filesystems @comment node-name, next, previous, up @subsection fstype Option @cindex FSinfo fstype filesystems option @@ -5887,7 +5922,7 @@ Example: fstype = swap @end example -@node FSinfo filesystems opts, FSinfo filesystems passno, FSinfo filesystems fstype, FSinfo filesystems +@node FSinfo opts Option, FSinfo passno Option, FSinfo fstype Option, FSinfo filesystems @comment node-name, next, previous, up @subsection opts Option @cindex FSinfo opts filesystems option @@ -5900,7 +5935,7 @@ This defines any options that should be given to @b{mount}(8) in the opts = rw,nosuid,grpid @end example -@node FSinfo filesystems passno, FSinfo filesystems freq, FSinfo filesystems opts, FSinfo filesystems +@node FSinfo passno Option, FSinfo freq Option, FSinfo opts Option, FSinfo filesystems @comment node-name, next, previous, up @subsection passno Option @cindex FSinfo passno filesystems option @@ -5915,7 +5950,7 @@ Example: passno = 1 @end example -@node FSinfo filesystems freq, FSinfo filesystems mount, FSinfo filesystems passno, FSinfo filesystems +@node FSinfo freq Option, FSinfo mount Option, FSinfo passno Option, FSinfo filesystems @comment node-name, next, previous, up @subsection freq Option @cindex FSinfo freq filesystems option @@ -5930,7 +5965,7 @@ Example: freq = 3 @end example -@node FSinfo filesystems mount, FSinfo filesystems dumpset, FSinfo filesystems freq, FSinfo filesystems +@node FSinfo mount Option, FSinfo dumpset Option, FSinfo freq Option, FSinfo filesystems @comment node-name, next, previous, up @subsection mount Option @cindex FSinfo mount filesystems option @@ -6000,7 +6035,7 @@ filesystem.@refill @end table -@node FSinfo filesystems dumpset, FSinfo filesystems log, FSinfo filesystems mount, FSinfo filesystems +@node FSinfo dumpset Option, FSinfo log Option, FSinfo mount Option, FSinfo filesystems @comment node-name, next, previous, up @subsection dumpset Option @cindex FSinfo dumpset filesystems option @@ -6009,7 +6044,7 @@ filesystem.@refill This provides support for Imperial College's local file backup tools and is not documented further here. -@node FSinfo filesystems log, , FSinfo filesystems dumpset, FSinfo filesystems +@node FSinfo log Option, , FSinfo dumpset Option, FSinfo filesystems @comment node-name, next, previous, up @subsection log Option @cindex FSinfo log filesystems option @@ -6505,8 +6540,8 @@ each level. @item pass number for @var{host}:@var{device} is non-zero Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap} -or @samp{export} and the @b{fsck}(8) pass number is set. Swap devices should not be -fsck'd. @xref{FSinfo filesystems fstype}. +or @samp{export} and the @b{fsck}(8) pass number is set. Swap devices +should not be fsck'd. @xref{FSinfo fstype Option}. @item sub-directory @var{directory} of @var{directory-tree} starts with '/' Within the filesystem specification for a host, if an element @@ -7180,6 +7215,7 @@ am-utils, and get installed. * lostaltmail.conf-sample:: * mk-amd-map:: * pawd:: +* redhat-ctl-amd:: * wait4amd:: * wait4amd2die:: * wire-test:: @@ -7274,8 +7310,8 @@ If you wish to generate Amd maps using the @i{hostd} (@pxref{hostd Selector Variable}) @i{Amd} map syntax, then define the environment variable @b{$DOMAIN} or modify the script. -Note that automount2amd does not understand newer Sun Automount map -syntax, those used by autofs. +Note that automount2amd does not understand the syntax in newer Sun +Automount maps, those used with autofs. @c ---------------------------------------------------------------- @node ctl-amd, ctl-hlfsd, automount2amd, Assorted Tools @@ -7437,7 +7473,7 @@ mk-amd-map @i{mapname} @end example @c ---------------------------------------------------------------- -@node pawd, wait4amd, mk-amd-map, Assorted Tools +@node pawd, redhat-ctl-amd, mk-amd-map, Assorted Tools @comment node-name, next, previous, up @section pawd @pindex pawd @@ -7455,7 +7491,20 @@ current working directory. With any number of arguments, it will print the adjusted path of each one of the arguments. @c ---------------------------------------------------------------- -@node wait4amd, wait4amd2die, pawd, Assorted Tools +@node redhat-ctl-amd, wait4amd, pawd, Assorted Tools +@comment node-name, next, previous, up +@section redhat-ctl-amd +@pindex redhat-ctl-amd + +This script is similar to @i{ctl-amd} (@pxref{ctl-amd}) but is intended +for Red Hat Linux systems. You can safely copy @i{redhat-ctl-amd} onto +@file{/etc/rc.d/init.d/amd}. The script supplied by @i{Am-utils} is +usually better than the one provided by Red Hat, because the Red Hat +script does not correctly kill @i{Amd} processes: it is too quick to +kill the wrong processes, leaving stale or hung mount points behind. + +@c ---------------------------------------------------------------- +@node wait4amd, wait4amd2die, redhat-ctl-amd, Assorted Tools @comment node-name, next, previous, up @section wait4amd @pindex wait4amd @@ -7905,7 +7954,7 @@ file service performance. @comment node-name, next, previous, up @section @samp{/tftpboot} in a chroot-ed environment @cindex /tftpboot in a chroot-ed environment -@cindex chroot: /tftpboot example +@cindex chroot; /tftpboot example In this complex example, we attempt to run an @i{Amd} process @emph{inside} a chroot-ed environment. @samp{tftpd} (Trivial FTP) is @@ -8308,4 +8357,5 @@ All other registered trademarks are owned by their respective owners. @c LocalWords: nointr extatt setchapternewpage columnfractions alphaev gnulibc @c LocalWords: freebsdelf gnuoldld ifhtml defperm nodefperm norrip RRIP rrip @c LocalWords: noversion attr XXXXXX netgrpd rh mkstemp uid gid noexec mntfs -@c LocalWords: nomnttab optionstr hrtime xdrtrace getpwd proplist +@c LocalWords: nomnttab optionstr hrtime xdrtrace getpwd proplist redhat ctl +@c LocalWords: texinfo texi ib sp cartouche ified xlatecookie diff --git a/dist/am-utils/fixmount/fixmount.8 b/dist/am-utils/fixmount/fixmount.8 index 083c992da9a2..1b5b55e0d8e1 100644 --- a/dist/am-utils/fixmount/fixmount.8 +++ b/dist/am-utils/fixmount/fixmount.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: fixmount.8,v 1.4 2001/12/18 09:31:48 wiz Exp $ +.\" $NetBSD: fixmount.8,v 1.5 2002/11/29 23:06:24 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -40,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" Id: fixmount.8,v 1.3.2.2 2001/01/10 03:23:32 ezk Exp +.\" Id: fixmount.8,v 1.6 2002/01/07 07:36:31 ezk Exp .\" .TH FIXMOUNT 8 "26 Feb 1993" .SH NAME diff --git a/dist/am-utils/fsinfo/fsi_lex.l b/dist/am-utils/fsinfo/fsi_lex.l index f1cad079f364..1f9cd2def711 100644 --- a/dist/am-utils/fsinfo/fsi_lex.l +++ b/dist/am-utils/fsinfo/fsi_lex.l @@ -1,8 +1,8 @@ -/* $NetBSD: fsi_lex.l,v 1.3 2001/05/13 18:06:59 veego Exp $ */ +/* $NetBSD: fsi_lex.l,v 1.4 2002/11/29 23:06:24 christos Exp $ */ %{ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -39,9 +39,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: fsi_lex.l,v 1.4.2.2 2001/01/10 03:23:33 ezk Exp + * Id: fsi_lex.l,v 1.8 2002/02/02 20:59:02 ezk Exp * */ diff --git a/dist/am-utils/fsinfo/fsi_util.c b/dist/am-utils/fsinfo/fsi_util.c index 2be88906ca90..ed532e97c0ac 100644 --- a/dist/am-utils/fsinfo/fsi_util.c +++ b/dist/am-utils/fsinfo/fsi_util.c @@ -1,7 +1,7 @@ -/* $NetBSD: fsi_util.c,v 1.4 2002/05/09 02:09:52 simonb Exp $ */ +/* $NetBSD: fsi_util.c,v 1.5 2002/11/29 23:06:24 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -35,9 +35,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: fsi_util.c,v 1.3.2.2 2001/01/10 03:23:33 ezk Exp + * Id: fsi_util.c,v 1.7 2002/02/02 20:59:02 ezk Exp * */ diff --git a/dist/am-utils/fsinfo/fsinfo.8 b/dist/am-utils/fsinfo/fsinfo.8 index 1ca46df6b7db..c23d1b2eba9c 100644 --- a/dist/am-utils/fsinfo/fsinfo.8 +++ b/dist/am-utils/fsinfo/fsinfo.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: fsinfo.8,v 1.2 2001/12/18 09:31:48 wiz Exp $ +.\" $NetBSD: fsinfo.8,v 1.3 2002/11/29 23:06:25 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 Erez Zadok .\" Copyright (c) 1993 Jan-Simon Pendry. .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -35,7 +35,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)fsinfo.8 8.1 (Berkeley) 6/28/93 -.\" Id: fsinfo.8,v 1.3.2.1 2001/01/10 03:23:34 ezk Exp +.\" Id: fsinfo.8,v 1.5 2002/01/07 07:36:32 ezk Exp .\" .TH FSINFO 8 "June 28, 1993" .SH NAME diff --git a/dist/am-utils/fsinfo/fsinfo.c b/dist/am-utils/fsinfo/fsinfo.c index 685b802b31ff..2d6363cf75ad 100644 --- a/dist/am-utils/fsinfo/fsinfo.c +++ b/dist/am-utils/fsinfo/fsinfo.c @@ -1,7 +1,7 @@ -/* $NetBSD: fsinfo.c,v 1.4 2001/05/13 18:06:59 veego Exp $ */ +/* $NetBSD: fsinfo.c,v 1.5 2002/11/29 23:06:25 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: fsinfo.c,v 1.5.2.2 2001/01/10 03:23:34 ezk Exp + * Id: fsinfo.c,v 1.9 2002/02/02 20:59:02 ezk Exp * */ diff --git a/dist/am-utils/fsinfo/fsinfo.h b/dist/am-utils/fsinfo/fsinfo.h index af6ba58b42c1..44e880078844 100644 --- a/dist/am-utils/fsinfo/fsinfo.h +++ b/dist/am-utils/fsinfo/fsinfo.h @@ -1,7 +1,7 @@ -/* $NetBSD: fsinfo.h,v 1.3 2001/05/13 18:06:59 veego Exp $ */ +/* $NetBSD: fsinfo.h,v 1.4 2002/11/29 23:06:25 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: fsinfo.h,v 1.4.2.2 2001/01/10 03:23:34 ezk Exp + * Id: fsinfo.h,v 1.8 2002/02/02 20:59:02 ezk Exp * */ diff --git a/dist/am-utils/hlfsd/hlfsd.8 b/dist/am-utils/hlfsd/hlfsd.8 index 57301dd4a2a4..e392cd8b59b7 100644 --- a/dist/am-utils/hlfsd/hlfsd.8 +++ b/dist/am-utils/hlfsd/hlfsd.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: hlfsd.8,v 1.2 2001/12/18 09:31:48 wiz Exp $ +.\" $NetBSD: hlfsd.8,v 1.3 2002/11/29 23:06:25 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -38,7 +38,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" Id: hlfsd.8,v 1.3.2.1 2001/01/10 03:23:35 ezk Exp +.\" Id: hlfsd.8,v 1.5 2002/01/07 07:36:32 ezk Exp .\" .\" HLFSD was written at Columbia University Computer Science Department, by .\" Erez Zadok and Alexander Dupuy diff --git a/dist/am-utils/hlfsd/hlfsd.c b/dist/am-utils/hlfsd/hlfsd.c index f95218667e88..610dba171550 100644 --- a/dist/am-utils/hlfsd/hlfsd.c +++ b/dist/am-utils/hlfsd/hlfsd.c @@ -1,7 +1,7 @@ -/* $NetBSD: hlfsd.c,v 1.3 2001/05/13 18:07:00 veego Exp $ */ +/* $NetBSD: hlfsd.c,v 1.4 2002/11/29 23:06:25 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: hlfsd.c,v 1.7.2.2 2001/01/10 03:23:35 ezk Exp + * Id: hlfsd.c,v 1.18 2002/06/23 01:05:40 ib42 Exp * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy @@ -265,12 +264,12 @@ main(int argc, char *argv[]) * Terminate if did not ask to forcecache (-C) and hlfsd would not be able * to set the minimum cache intervals. */ -#if !defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNT2_NFS_OPT_NOAC) && !defined(HAVE_FIELD_NFS_ARGS_T_ACREGMIN) +#if !defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNT2_NFS_OPT_NOAC) && !defined(HAVE_NFS_ARGS_T_ACREGMIN) if (!forcecache) { fprintf(stderr, "%s: will not be able to turn off attribute caches.\n", am_get_progname()); exit(1); } -#endif /* !defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNT2_NFS_OPT_NOAC) && !defined(HAVE_FIELD_NFS_ARGS_T_ACREGMIN) */ +#endif /* !defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNT2_NFS_OPT_NOAC) && !defined(HAVE_NFS_ARGS_T_ACREGMIN) */ switch (argc - optind) { @@ -500,7 +499,11 @@ main(int argc, char *argv[]) * If they don't appear to support the either the "ignore" mnttab * option entry, or the "auto" one, set the mount type to "nfs". */ +#ifdef HIDE_MOUNT_TYPE mnt.mnt_type = HIDE_MOUNT_TYPE; +#else /* not HIDE_MOUNT_TYPE */ + mnt.mnt_type = "nfs"; +#endif /* not HIDE_MOUNT_TYPE */ /* some systems don't have a mount type, but a mount flag */ #ifndef HAVE_TRANSPORT_TYPE_TLI @@ -551,6 +554,7 @@ main(int argc, char *argv[]) compute_nfs_args(&nfs_args, &mnt, genflags, + NULL, &localsocket, NFS_VERSION, /* version 2 */ "udp", /* XXX: shouldn't this be "udp"? */ @@ -583,16 +587,16 @@ main(int argc, char *argv[]) * signal handler to perform the mount in N seconds via some alarm. * -Erez Zadok. */ - if (debug_flags & D_DAEMON) { /* asked for -D daemon */ + amuDebug(D_DAEMON) { /* asked for -D daemon */ plog(XLOG_INFO, "parent NFS mounting hlfsd service points"); - if (mount_fs(&mnt, genflags, (caddr_t) &nfs_args, retry, type, 0, NULL, mnttab_file_name) < 0) + if (mount_fs2(&mnt, dir_name, genflags, (caddr_t) &nfs_args, retry, type, 0, NULL, mnttab_file_name) < 0) fatal("nfsmount: %m"); } else { /* asked for -D nodaemon */ if (fork() == 0) { /* child runs mount */ am_set_mypid(); foreground = 0; plog(XLOG_INFO, "child NFS mounting hlfsd service points"); - if (mount_fs(&mnt, genflags, (caddr_t) &nfs_args, retry, type, 0, NULL, mnttab_file_name) < 0) { + if (mount_fs2(&mnt, dir_name, genflags, (caddr_t) &nfs_args, retry, type, 0, NULL, mnttab_file_name) < 0) { fatal("nfsmount: %m"); } exit(0); /* all went well */ @@ -602,7 +606,7 @@ main(int argc, char *argv[]) } #else /* not DEBUG */ plog(XLOG_INFO, "normal NFS mounting hlfsd service points"); - if (mount_fs(&mnt, genflags, (caddr_t) &nfs_args, retry, type, 2, "udp", mnttab_file_name) < 0) + if (mount_fs2(&mnt, dir_name, genflags, (caddr_t) &nfs_args, retry, type, 2, "udp", mnttab_file_name) < 0) fatal("nfsmount: %m"); #endif /* not DEBUG */ @@ -622,7 +626,6 @@ main(int argc, char *argv[]) printf("%d\n", masterpid); plog(XLOG_INFO, "hlfsd ready to serve"); -#ifdef DEBUG /* * If asked not to fork a daemon (-D nodaemon), then hlfsd_init() * will not run svc_run. We must start svc_run here. @@ -630,7 +633,6 @@ main(int argc, char *argv[]) dlog("starting no-daemon debugging svc_run"); amuDebugNo(D_DAEMON) svc_run(); -#endif /* DEBUG */ cleanup(0); /* should never happen here */ return (0); /* everything went fine? */ @@ -865,7 +867,7 @@ cleanup(int signum) am_set_mypid(); for (;;) { - while ((umount_result = UMOUNT_FS(dir_name, mnttab_file_name)) == EBUSY) { + while ((umount_result = UMOUNT_FS(dir_name, dir_name, mnttab_file_name)) == EBUSY) { #ifdef DEBUG dlog("cleanup(): umount delaying for 10 seconds"); #endif /* DEBUG */ diff --git a/dist/am-utils/hlfsd/hlfsd.h b/dist/am-utils/hlfsd/hlfsd.h index 59ed603d770b..373d5492315a 100644 --- a/dist/am-utils/hlfsd/hlfsd.h +++ b/dist/am-utils/hlfsd/hlfsd.h @@ -1,7 +1,7 @@ -/* $NetBSD: hlfsd.h,v 1.2 2001/07/14 06:01:23 mrg Exp $ */ +/* $NetBSD: hlfsd.h,v 1.3 2002/11/29 23:06:25 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: hlfsd.h,v 1.4.2.2 2001/01/12 22:47:21 ro Exp + * Id: hlfsd.h,v 1.10 2002/02/02 20:59:03 ezk Exp * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy @@ -54,7 +53,7 @@ * MACROS AND CONSTANTS: */ -#define HLFSD_VERSION "hlfsd 1.1 (1993-2001)" +#define HLFSD_VERSION "hlfsd 1.2 (1993-2002)" #define PERS_SPOOLMODE 0755 #define OPEN_SPOOLMODE 01777 #define DOTSTRING "." @@ -140,7 +139,7 @@ extern SVCXPRT *nfs_program_2_transp; /* For quick_reply() */ extern SVCXPRT *nfsxprt; extern char *alt_spooldir; extern char *home_subdir; -extern char *homedir(int); +extern char *homedir(int, int); extern char *mailbox(int, char *); extern char *passwdfile; extern char *slinkname; diff --git a/dist/am-utils/include/am_defs.h b/dist/am-utils/include/am_defs.h index 08ec1fc07d85..a1c3d62dac0e 100644 --- a/dist/am-utils/include/am_defs.h +++ b/dist/am-utils/include/am_defs.h @@ -1,7 +1,7 @@ -/* $NetBSD: am_defs.h,v 1.2 2002/05/30 14:48:45 itojun Exp $ */ +/* $NetBSD: am_defs.h,v 1.3 2002/11/29 23:06:25 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: am_defs.h,v 1.15.2.9 2001/04/07 00:47:44 ib42 Exp + * Id: am_defs.h,v 1.30 2002/06/23 01:05:40 ib42 Exp * */ @@ -196,6 +195,12 @@ char *strchr(), *strrchr(), *strdup(); * Actions to take if HAVE_FCNTL_H is defined. */ #if HAVE_FCNTL_H +# ifdef HAVE_LINUX_LOOP_H +/* so I can mount large files as loop devices */ +/* XXX: need to move these two LARGEFILE defines to a better place */ +# define _LARGEFILE64_SOURCE +# define __USE_LARGEFILE64 +# endif /* HAVE_LINUX_LOOP_H */ # include #endif /* HAVE_FCNTL_H */ @@ -392,6 +397,13 @@ extern int errno; # include #endif /* HAVE_NET_IF_H */ +/* + * Actions to take if exists. + */ +#ifdef HAVE_SYS_MMAN_H +# include +#endif /* HAVE_SYS_MMAN_H */ + /* * Actions to take if exists. */ @@ -588,15 +600,19 @@ struct ypall_callback; #endif /* HAVE_CDFS_CDFSMOUNT_H */ /* - * Actions to take if exists. + * Actions to take if exists. * We really don't want pulled in here */ #ifndef _LINUX_FS_H #define _LINUX_FS_H #endif /* _LINUX_FS_H */ -#ifdef HAVE_LINUX_AUTO_FS_H -# include -#endif /* HAVE_LINUX_AUTO_FS_H */ +#ifdef HAVE_LINUX_AUTO_FS4_H +# include +#else /* not HAVE_LINUX_AUTO_FS4_H */ +# ifdef HAVE_LINUX_AUTO_FS_H +# include +# endif /* HAVE_LINUX_AUTO_FS_H */ +#endif /* not HAVE_LINUX_AUTO_FS4_H */ /* * Actions to take if exists. @@ -606,15 +622,28 @@ struct ypall_callback; #endif /* HAVE_SYS_FS_AUTOFS_H */ /* - * Actions to take if exists. - * We really don't want pulled in here + * Actions to take if exists. */ -#ifndef _LINUX_FS_H -#define _LINUX_FS_H -#endif /* _LINUX_FS_H */ -#ifdef HAVE_SYS_FS_AUTOFS_PROT_H -# include -#endif /* HAVE_SYS_FS_AUTOFS_PROT_H */ +#ifdef HAVE_LINUX_LOOP_H +# ifdef HAVE_LINUX_POSIX_TYPES_H +# include +# endif /* HAVE_LINUX_POSIX_TYPES_H */ +/* next dev_t lines needed due to changes in kernel code */ +# undef dev_t +# define dev_t __kernel_dev_t +# include +#endif /* HAVE_LINUX_LOOP_H */ + +/* + * Actions to take if or exist. + */ +#ifdef HAVE_RPCSVC_AUTOFS_PROT_H +# include +#else /* not HAVE_RPCSVC_AUTOFS_PROT_H */ +# ifdef HAVE_SYS_FS_AUTOFS_PROT_H +# include +# endif /* HAVE_SYS_FS_AUTOFS_PROT_H */ +#endif /* not HAVE_RPCSVC_AUTOFS_PROT_H */ /* * NFS PROTOCOL HEADER FILES: @@ -1411,6 +1440,10 @@ extern int wait3(int *statusp, int options, struct rusage *rusage); extern int vsnprintf(char *, int, const char *, ...); #endif /* defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF) */ +#ifndef HAVE_EXTERN_XDR_CALLMSG +extern bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *msg); +#endif /* not HAVE_EXTERN_XDR_CALLMSG */ + #ifndef HAVE_EXTERN_XDR_OPAQUE_AUTH extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth); #endif /* not HAVE_EXTERN_XDR_OPAQUE_AUTH */ @@ -1422,11 +1455,10 @@ extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth); #ifdef THIS_HEADER_FILE_IS_INCLUDED_ABOVE # include #endif /* THIS_HEADER_FILE_IS_INCLUDED_ABOVE */ +#include #include #include #include -/* compatibility with old amd, while autoconfiscating it */ -#include /****************************************************************************/ diff --git a/dist/am-utils/include/am_utils.h b/dist/am-utils/include/am_utils.h index fc2d93091896..d82eab231618 100644 --- a/dist/am-utils/include/am_utils.h +++ b/dist/am-utils/include/am_utils.h @@ -1,7 +1,7 @@ -/* $NetBSD: am_utils.h,v 1.3 2001/05/13 18:07:00 veego Exp $ */ +/* $NetBSD: am_utils.h,v 1.4 2002/11/29 23:06:26 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: am_utils.h,v 1.11.2.6 2001/02/23 01:03:40 ezk Exp + * Id: am_utils.h,v 1.40 2002/06/23 01:05:40 ib42 Exp * */ @@ -52,6 +51,8 @@ #define _AM_UTILS_H +#include "aux_conf.h" + /**************************************************************************/ /*** MACROS ***/ /**************************************************************************/ @@ -96,6 +97,7 @@ #define STREQ(s1, s2) (strcmp((s1), (s2)) == 0) #define STRCEQ(s1, s2) (strcasecmp((s1), (s2)) == 0) #define NSTREQ(s1, s2, n) (strncmp((s1), (s2), (n)) == 0) +#define NSTRCEQ(s1, s2, n) (strncasecmp((s1), (s2), (n)) == 0) #define FSTREQ(s1, s2) ((*(s1) == *(s2)) && STREQ((s1),(s2))) /* @@ -147,15 +149,21 @@ * 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, mtb_name) umount_fs(dir, mtb_name) +#define UMOUNT_FS(dir, real_dir, mtb_name) umount_fs2(dir, real_dir, mtb_name) + /* imported via $srcdir/conf/umount/umount_*.c */ -extern int umount_fs(char *fs_name, const char *mnttabname); +extern int umount_fs2(char *mntdir, char *real_mntdir, const char *mnttabname); +extern int umount_fs(char *mntdir, const char *mnttabname); /* - * macros for automounter vfs/vnode operations. + * macro definitions for automounter vfs/vnode operations. */ #define VLOOK_CREATE 0x1 #define VLOOK_DELETE 0x2 + +/* + * macro definitions for automounter vfs capabilities + */ #define FS_DIRECTORY 0x0001 /* This looks like a dir, not a link */ #define FS_MBACKGROUND 0x0002 /* Should background this mount */ #define FS_NOTIMEOUT 0x0004 /* Don't bother with timeouts */ @@ -164,6 +172,8 @@ extern int umount_fs(char *fs_name, const char *mnttabname); #define FS_BACKGROUND (FS_MBACKGROUND|FS_UBACKGROUND) #define FS_DISCARD 0x0020 /* Discard immediately on last reference */ #define FS_AMQINFO 0x0040 /* Amq is interested in this fs type */ +#define FS_AUTOFS 0x0080 /* This filesystem supports autofs handling */ +#define FS_DIRECT 0x0100 /* Direct mount */ /* * macros for struct fserver. @@ -188,18 +198,17 @@ extern int umount_fs(char *fs_name, const char *mnttabname); #define MFF_LOGDOWN 0x0040 /* Logged that this mount is down */ #define MFF_RSTKEEP 0x0080 /* Don't timeout this filesystem - restarted */ #define MFF_WANTTIMO 0x0100 /* Need a timeout call when not busy */ -#ifdef HAVE_AMU_FS_NFSL -# define MFF_NFSLINK 0x0200 /* nfsl type, and deemed a link */ -#endif /* HAVE_AMU_FS_NFSL */ +#define MFF_NFSLINK 0x0200 /* nfsl type, and deemed a link */ +#define MFF_AUTOFS 0x0400 /* this filesystem is of type autofs */ +#define MFF_NFS_SCALEDOWN 0x0800 /* the mount failed, retry with v2/UDP */ /* * macros for struct am_node (map of auto-mount points). */ #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 */ +#define AMF_AUTOFS 0x0004 /* This node is part of an autofs filesystem */ +#define AMF_REMOUNT 0x0008 /* This node needs to be remounted */ /* * The following values can be tuned... @@ -310,6 +319,7 @@ struct am_opts { char *opt_rhost; char *opt_sublink; char *opt_type; + char *opt_mount_type; /* "nfs" or "autofs" */ char *opt_unmount; char *opt_user; char *opt_maptype; /* map type: file, nis, hesiod, etc. */ @@ -325,15 +335,22 @@ struct mntfs { am_ops *mf_ops; /* Operations on this mountpoint */ am_opts *mf_fo; /* File opts */ char *mf_mount; /* "/a/kiska/home/kiska" */ + char *mf_real_mount; /* Mount point as passed to mount(2) + -- home of the append-a-space autofs hack */ char *mf_info; /* Mount info */ char *mf_auto; /* Automount opts */ char *mf_mopts; /* FS mount opts */ char *mf_remopts; /* Remote FS mount opts */ + char *mf_loopdev; /* loop device name for /dev/loop mounts */ fserver *mf_server; /* File server */ + int mf_fsflags; /* Flags FS_* copied from mf_ops->*_fs_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 */ +#ifdef HAVE_FS_AUTOFS + autofs_fh_t *mf_autofs_fh; +#endif /* HAVE_FS_AUTOFS */ void (*mf_prfree) (voidp); /* Free private space */ voidp mf_private; /* Private - per-fs data */ }; @@ -370,32 +387,33 @@ typedef union am_nfs_handle am_nfs_handle_t; */ typedef char *(*vfs_match) (am_opts *); typedef int (*vfs_init) (mntfs *); -typedef int (*vmount_fs) (am_node *); -typedef int (*vfmount_fs) (mntfs *); -typedef int (*vumount_fs) (am_node *); -typedef int (*vfumount_fs) (mntfs *); -typedef am_node *(*vlookuppn) (am_node *, char *, int *, int); +typedef int (*vmount_fs) (am_node *, mntfs *mf); +typedef int (*vumount_fs) (am_node *, mntfs *mf); +typedef am_node *(*vlookup_child) (am_node *, char *, int *, int); +typedef am_node *(*vmount_child) (am_node *, int *); typedef int (*vreaddir) (am_node *, nfscookie, nfsdirlist *, nfsentry *, int); typedef am_node *(*vreadlink) (am_node *, int *); -typedef void (*vmounted) (mntfs *); -typedef void (*vumounted) (am_node *); +typedef void (*vmounted) (mntfs *mf); +typedef void (*vumounted) (mntfs *mf); typedef fserver *(*vffserver) (mntfs *); struct am_ops { - char *fs_type; /* type of filesystems "nfsx" */ + char *fs_type; /* type of filesystems e.g. "nfsx" */ vfs_match fs_match; /* fxn: match */ vfs_init fs_init; /* fxn: initialization */ - vmount_fs mount_fs; /* fxn: mount vnode */ - vfmount_fs fmount_fs; /* fxn: mount VFS */ - vumount_fs umount_fs; /* fxn: unmount vnode */ - vfumount_fs fumount_fs; /* fxn: unmount VFS */ - vlookuppn lookuppn; /* fxn: lookup path-name */ + vmount_fs mount_fs; /* fxn: mount my own vnode */ + vumount_fs umount_fs; /* fxn: unmount my own vnode */ + vlookup_child lookup_child; /* fxn: lookup path-name */ + vmount_child mount_child; /* fxn: mount path-name */ vreaddir readdir; /* fxn: read directory */ vreadlink readlink; /* fxn: read link */ vmounted mounted; /* fxn: after-mount extra actions */ vumounted umounted; /* fxn: after-umount extra actions */ vffserver ffserver; /* fxn: find a file server */ - int fs_flags; /* filesystem flags FS_* */ + int nfs_fs_flags; /* filesystem flags FS_* for nfs mounts */ +#ifdef HAVE_FS_AUTOFS + int autofs_fs_flags;/* filesystem flags FS_* for autofs mounts */ +#endif /* HAVE_FS_AUTOFS */ }; typedef int (*task_fun) (voidp); @@ -466,6 +484,7 @@ struct fserver { struct am_node { int am_mapno; /* Map number */ mntfs *am_mnt; /* Mounted filesystem */ + mntfs **am_mfarray; /* Filesystem sources to try to mount */ char *am_name; /* "kiska": name of this node */ char *am_path; /* "/home/kiska": path of this node's mount point */ char *am_link; /* "/a/kiska/home/kiska/this/that": link to sub-dir */ @@ -484,6 +503,12 @@ struct am_node { char *am_pref; /* Mount info prefix */ am_stats am_stats; /* Statistics gathering */ SVCXPRT *am_transp; /* Info for quick reply */ + dev_t am_dev; /* Device number */ + dev_t am_rdev; /* Remote/real device number */ +#ifdef HAVE_FS_AUTOFS + autofs_data_t *am_autofs_data; /* Autofs private data */ + void (*am_autofs_free_data)(autofs_data_t *); /* Autofs cleanup func */ +#endif /* HAVE_FS_AUTOFS */ }; @@ -544,7 +569,6 @@ extern u_short nfs_port; /* Our NFS service port */ */ extern CLIENT *get_mount_client(char *unused_host, struct sockaddr_in *sin, struct timeval *tv, int *sock, u_long mnt_version); extern RETSIGTYPE sigchld(int); -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); @@ -555,7 +579,7 @@ extern am_ops *ops_match(am_opts *, char *, char *, char *, char *, char *); extern bool_t xdr_amq_string(XDR *xdrs, amq_string *objp); extern bool_t xdr_dirpath(XDR *xdrs, dirpath *objp); extern char **strsplit(char *, int, int); -extern char *expand_key(char *); +extern char *expand_selectors(char *); extern char *get_version_string(void); extern char *inet_dquad(char *, u_long); extern char *print_wires(void); @@ -567,6 +591,7 @@ extern fserver *dup_srvr(fserver *); extern int amu_close(int fd); extern int background(void); extern int bind_resv_port(int, u_short *); +extern int bind_resv_port2(u_short *); extern int cmdoption(char *, struct opt_tab *, int *); extern int compute_automounter_mount_flags(mntent_t *); extern int compute_mount_flags(mntent_t *); @@ -591,6 +616,7 @@ 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 *, const char *); +extern int mount_fs2(mntent_t *, char *, 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); @@ -671,6 +697,7 @@ extern voidp xmalloc(int); extern voidp xrealloc(voidp, int); extern voidp xzalloc(int); extern u_long get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const char *proto); +extern long get_server_pid(void); #ifdef MOUNT_TABLE_ON_FILE @@ -683,27 +710,26 @@ extern void write_mntent(mntent_t *, const char *); extern int syslogging; #endif /* defined(HAVE_SYSLOG_H) || defined(HAVE_SYS_SYSLOG_H) */ -#ifdef HAVE_TRANSPORT_TYPE_TLI - extern void compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig *nfsncp, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name); extern int create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, struct netconfig **udp_amqncpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp, struct netconfig **tcp_amqncpp); extern int create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp)); +extern int amu_svc_register(SVCXPRT *, u_long, u_long, void (*)(), u_long, struct netconfig *); + +#ifdef HAVE_TRANSPORT_TYPE_TLI + extern int get_knetconfig(struct knetconfig **kncpp, struct netconfig *in_ncp, char *nc_protoname); extern struct netconfig *nfsncp; extern void free_knetconfig(struct knetconfig *kncp); #else /* not HAVE_TRANSPORT_TYPE_TLI */ -extern void compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name); extern enum clnt_stat pmap_ping(struct sockaddr_in *address); -extern int create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp); -extern int create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp)); #endif /* not HAVE_TRANSPORT_TYPE_TLI */ -#ifndef HAVE_FIELD_STRUCT_FHSTATUS_FHS_FH +#ifndef HAVE_STRUCT_FHSTATUS_FHS_FH # define fhs_fh fhstatus_u.fhs_fhandle -#endif /* not HAVE_FIELD_STRUCT_FHSTATUS_FHS_FH */ +#endif /* not HAVE_STRUCT_FHSTATUS_FHS_FH */ /**************************************************************************/ @@ -752,11 +778,11 @@ extern am_ops cachefs_ops; #ifdef HAVE_FS_NFS extern am_ops nfs_ops; /* NFS */ extern fserver *find_nfs_srvr (mntfs *); -extern int nfs_fmount(mntfs *mf); -extern int nfs_fumount(mntfs *mf); +extern int nfs_mount(am_node *am, mntfs *mf); +extern int nfs_umount(am_node *am, mntfs *mf); extern int nfs_init(mntfs *mf); extern qelem nfs_srvr_list; -extern void nfs_umounted(am_node *mp); +extern void nfs_umounted(mntfs *mf); #endif /* HAVE_FS_NFS */ @@ -791,14 +817,13 @@ extern am_ops amfs_auto_ops; /* Automount file system (this!) */ extern am_ops amfs_toplvl_ops; /* Top-level automount file system */ extern am_ops amfs_root_ops; /* Root file system */ extern qelem amfs_auto_srvr_list; -extern am_node *amfs_auto_lookuppn(am_node *mp, char *fname, int *error_return, int op); +extern am_node *amfs_auto_lookup_child(am_node *mp, char *fname, int *error_return, int op); +extern am_node *amfs_auto_mount_child(am_node *ap, int *error_return); extern am_node *next_nonerror_node(am_node *xp); extern char *amfs_auto_match(am_opts *fo); extern fserver *find_amfs_auto_srvr(mntfs *); extern int amfs_auto_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, int count); -extern int amfs_auto_umount(am_node *mp); -extern int amfs_auto_fmount(am_node *mp); -extern int amfs_auto_fumount(am_node *mp); +extern int amfs_auto_umount(am_node *mp, mntfs *mf); #endif /* HAVE_AMU_FS_AUTO */ /* @@ -806,9 +831,9 @@ extern int amfs_auto_fumount(am_node *mp); */ #ifdef HAVE_AMU_FS_TOPLVL extern am_ops amfs_toplvl_ops; /* Toplvl Automount file system */ -extern int amfs_toplvl_mount(am_node *mp); -extern int amfs_toplvl_umount(am_node *mp); -extern void amfs_toplvl_mounted(mntfs *mf); +extern int amfs_toplvl_mount(am_node *mp, mntfs *mf); +extern int amfs_toplvl_umount(am_node *mp, mntfs *mf); +extern void amfs_toplvl_mounted(am_node *am, mntfs *mf); #endif /* HAVE_AMU_FS_TOPLVL */ /* @@ -823,7 +848,8 @@ extern am_ops amfs_direct_ops; /* Direct Automount file system (this too) */ */ #ifdef HAVE_AMU_FS_ERROR extern am_ops amfs_error_ops; /* Error file system */ -extern am_node *amfs_error_lookuppn(am_node *mp, char *fname, int *error_return, int op); +extern am_node *amfs_error_lookup_child(am_node *mp, char *fname, int *error_return, int op); +extern am_node *amfs_error_mount_child(am_node *ap, int *error_return); extern int amfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, int count); #endif /* HAVE_AMU_FS_ERROR */ @@ -869,7 +895,6 @@ extern am_ops amfs_program_ops; /* Program File System */ */ #ifdef HAVE_AMU_FS_LINK extern am_ops amfs_link_ops; /* Symlink FS */ -extern int amfs_link_fmount(mntfs *mf); #endif /* HAVE_AMU_FS_LINK */ /* @@ -888,13 +913,6 @@ extern am_ops amfs_linkx_ops; /* Symlink FS with existence check */ extern am_ops amfs_union_ops; /* Union FS */ #endif /* HAVE_AMU_FS_UNION */ -/* - * Autofs file system - */ -#ifdef HAVE_FS_AUTOFS -extern am_ops autofs_ops; /* (Sun) Autofs FS */ -#endif /* HAVE_FS_AUTOFS */ - /**************************************************************************/ /*** DEBUGGING ***/ @@ -905,7 +923,7 @@ extern am_ops autofs_ops; /* (Sun) Autofs FS */ */ #ifdef DEBUG -# define D_ALL (~0) +# define D_ALL (~(D_MTAB|D_HRTIME)) # define D_DAEMON 0x0001 /* Enter daemon mode */ # define D_TRACE 0x0002 /* Do protocol trace */ # define D_FULL 0x0004 /* Do full trace */ @@ -958,6 +976,7 @@ extern void malloc_verify(void); /* functions that depend solely on debugging */ extern void print_nfs_args(const nfs_args_t *nap, u_long nfs_version); +extern int debug_option (char *opt); #else /* not DEBUG */ @@ -967,10 +986,16 @@ extern void print_nfs_args(const nfs_args_t *nap, u_long nfs_version); */ # define XFREE(x) free(x) +#define amuDebug(x) if (0) +#define dlog if (0) dplog +#define amuDebugNo(x) if (0) + +#define print_nfs_args(nap, nfs_version) +#define debug_option(x) (1) + #endif /* not DEBUG */ extern int debug_flags; /* Debug options */ -extern int debug_option (char *opt); extern struct opt_tab dbg_opt[]; extern void dplog(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); diff --git a/dist/am-utils/include/amq_defs.h b/dist/am-utils/include/amq_defs.h index d2c7041bd5d3..68fd75c775a1 100644 --- a/dist/am-utils/include/amq_defs.h +++ b/dist/am-utils/include/amq_defs.h @@ -1,7 +1,7 @@ -/* $NetBSD: amq_defs.h,v 1.4 2001/05/13 18:07:00 veego Exp $ */ +/* $NetBSD: amq_defs.h,v 1.5 2002/11/29 23:06:26 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: amq_defs.h,v 1.4.2.1 2001/01/10 03:23:38 ezk Exp + * Id: amq_defs.h,v 1.7 2002/02/02 20:59:04 ezk Exp * */ diff --git a/dist/am-utils/libamu/hasmntopt.c b/dist/am-utils/libamu/hasmntopt.c index 61e627f72961..b3aaf9defb73 100644 --- a/dist/am-utils/libamu/hasmntopt.c +++ b/dist/am-utils/libamu/hasmntopt.c @@ -1,7 +1,7 @@ -/* $NetBSD: hasmntopt.c,v 1.2 2001/09/16 00:01:15 thorpej Exp $ */ +/* $NetBSD: hasmntopt.c,v 1.3 2002/11/29 23:06:26 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ n * modification, are permitted provided that the following conditions * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: hasmntopt.c,v 1.3.2.1 2001/01/10 03:23:39 ezk Exp + * Id: hasmntopt.c,v 1.6 2002/02/02 20:59:04 ezk Exp * */ diff --git a/dist/am-utils/libamu/mount_fs.c b/dist/am-utils/libamu/mount_fs.c index f3c76e30b37b..65cf0180cf6b 100644 --- a/dist/am-utils/libamu/mount_fs.c +++ b/dist/am-utils/libamu/mount_fs.c @@ -1,7 +1,7 @@ -/* $NetBSD: mount_fs.c,v 1.5 2002/06/23 08:37:36 tron Exp $ */ +/* $NetBSD: mount_fs.c,v 1.6 2002/11/29 23:06:26 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: mount_fs.c,v 1.11.2.5 2001/04/14 21:08:25 ezk Exp + * Id: mount_fs.c,v 1.26 2002/06/23 01:05:41 ib42 Exp * */ @@ -107,17 +106,12 @@ struct opt_tab mnt_flags[] = {MNTTAB_OPT_OVERLAY, MNT2_GEN_OPT_OVERLAY}, #endif /* defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) */ -#if defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST) - {MNTTAB_OPT_PROPLIST, MNT2_NFS_OPT_PROPLIST}, -#endif /* defined(MNT2_NFS_OPT_PROPLIST) && defined(MNTTAB_OPT_PROPLIST) */ - -#if defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) - {MNTTAB_OPT_NOLOCK, MNT2_NFS_OPT_NONLM}, -#endif /* defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) */ - -#if defined(MNT2_NFS_OPT_XLATECOOKIE) && defined(MNTTAB_OPT_XLATECOOKIE) - {MNTTAB_OPT_XLATECOOKIE, MNT2_NFS_OPT_XLATECOOKIE}, -#endif /* defined(MNT2_NFS_OPT_XLATECOOKIE) && defined(MNTTAB_OPT_XLATECOOKIE) */ + /* + * Do not define MNT2_NFS_OPT_* entries here! This is for generic + * mount(2) options only, not for NFS mount options. If you need to put + * something here, it's probably not the right place: see + * include/am_compat.h. + */ {0, 0} }; @@ -138,6 +132,7 @@ compute_mount_flags(mntent_t *mntp) flags = 0; #endif /* not MNT2_GEN_OPT_NEWTYPE */ +#if 0 /* redundant? */ #if defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) /* * Overlay this amd mount (presumably on another amd which died @@ -149,6 +144,7 @@ compute_mount_flags(mntent_t *mntp) plog(XLOG_INFO, "using an overlay mount"); } #endif /* defined(MNT2_GEN_OVERLAY) && defined(MNTOPT_OVERLAY) */ +#endif /* * Crack basic mount options @@ -180,6 +176,13 @@ compute_automounter_mount_flags(mntent_t *mntp) int mount_fs(mntent_t *mnt, int flags, caddr_t mnt_data, int retry, MTYPE_TYPE type, u_long nfs_version, const char *nfs_proto, const char *mnttabname) +{ + return mount_fs2(mnt, mnt->mnt_dir, flags, mnt_data, retry, type, nfs_version, nfs_proto, mnttabname); +} + + +int +mount_fs2(mntent_t *mnt, char *real_mntdir, int flags, caddr_t mnt_data, int retry, MTYPE_TYPE type, u_long nfs_version, const char *nfs_proto, const char *mnttabname) { int error = 0; #ifdef MOUNT_TABLE_ON_FILE @@ -192,10 +195,15 @@ mount_fs(mntent_t *mnt, int flags, caddr_t mnt_data, int retry, MTYPE_TYPE type, # endif /* defined(MNTTAB_OPT_DEV) || (defined(HAVE_FS_NFS3) && defined(MNTTAB_OPT_VERS)) || defined(MNTTAB_OPT_PROTO) */ #endif /* MOUNT_TABLE_ON_FILE */ -#ifdef DEBUG - dlog("%s fstype " MTYPE_PRINTF_TYPE " (%s) flags %#x (%s)", - mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts); -#endif /* DEBUG */ + char *old_mnt_dir; + + old_mnt_dir = mnt->mnt_dir; + mnt->mnt_dir = real_mntdir; + + amuDebug(D_FULL) { + dlog("'%s' fstype " MTYPE_PRINTF_TYPE " (%s) flags %#x (%s)", + mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts); + } again: clock_valid = 0; @@ -219,9 +227,9 @@ again: */ errno = mkdirs(mnt->mnt_dir, 0555); if (errno != 0 && errno != EEXIST) - plog(XLOG_ERROR, "%s: mkdirs: %m", mnt->mnt_dir); + plog(XLOG_ERROR, "'%s': mkdirs: %m", mnt->mnt_dir); else { - plog(XLOG_WARNING, "extra mkdirs required for %s", + plog(XLOG_WARNING, "extra mkdirs required for '%s'", mnt->mnt_dir); error = MOUNT_TRAP(type, mnt, flags, mnt_data); } @@ -232,11 +240,11 @@ again: * points around which need to be removed before we * can mount something new in their place. */ - errno = umount_fs(mnt->mnt_dir, mnttabname); + errno = umount_fs2(old_mnt_dir, mnt->mnt_dir, mnttabname); if (errno != 0) - plog(XLOG_ERROR, "%s: umount: %m", mnt->mnt_dir); + plog(XLOG_ERROR, "'%s': umount: %m", mnt->mnt_dir); else { - plog(XLOG_WARNING, "extra umount required for %s", + plog(XLOG_WARNING, "extra umount required for '%s'", mnt->mnt_dir); error = MOUNT_TRAP(type, mnt, flags, mnt_data); } @@ -276,6 +284,8 @@ again: } # endif /* MNTTAB_OPT_DEV */ + mnt->mnt_dir = old_mnt_dir; + # if defined(HAVE_FS_NFS3) && defined(MNTTAB_OPT_VERS) /* * add the extra vers={2,3} field to the mount table, @@ -306,25 +316,25 @@ again: * Additional fields in mntent_t * are fixed up here */ -# ifdef HAVE_FIELD_MNTENT_T_MNT_CNODE +# ifdef HAVE_MNTENT_T_MNT_CNODE mnt->mnt_cnode = 0; -# endif /* HAVE_FIELD_MNTENT_T_MNT_CNODE */ +# endif /* HAVE_MNTENT_T_MNT_CNODE */ -# ifdef HAVE_FIELD_MNTENT_T_MNT_RO +# ifdef HAVE_MNTENT_T_MNT_RO mnt->mnt_ro = (hasmntopt(mnt, MNTTAB_OPT_RO) != NULL); -# endif /* HAVE_FIELD_MNTENT_T_MNT_RO */ +# endif /* HAVE_MNTENT_T_MNT_RO */ -# ifdef HAVE_FIELD_MNTENT_T_MNT_TIME -# ifdef HAVE_FIELD_MNTENT_T_MNT_TIME_STRING +# ifdef HAVE_MNTENT_T_MNT_TIME +# ifdef HAVE_MNTENT_T_MNT_TIME_STRING { /* allocate enough space for a long */ char *str = (char *) xmalloc(13 * sizeof(char)); sprintf(str, "%ld", time((time_t *) NULL)); mnt->mnt_time = str; } -# else /* not HAVE_FIELD_MNTENT_T_MNT_TIME_STRING */ +# else /* not HAVE_MNTENT_T_MNT_TIME_STRING */ mnt->mnt_time = time((time_t *) NULL); -# endif /* not HAVE_FIELD_MNTENT_T_MNT_TIME_STRING */ -# endif /* HAVE_FIELD_MNTENT_T_MNT_TIME */ +# endif /* not HAVE_MNTENT_T_MNT_TIME_STRING */ +# endif /* HAVE_MNTENT_T_MNT_TIME */ write_mntent(mnt, mnttabname); @@ -355,11 +365,7 @@ again: * fs_name: remote file system name to mount */ void -#ifdef HAVE_TRANSPORT_TYPE_TLI compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig *nfsncp, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name) -#else /* not HAVE_TRANSPORT_TYPE_TLI */ -compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name) -#endif /* not HAVE_TRANSPORT_TYPE_TLI */ { int acval = 0; #ifdef HAVE_FS_NFS3 @@ -380,7 +386,7 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ fhp->v3.mountres3_u.mountinfo.fhandle.fhandle3_val, fh3.fh3_length); -# if defined(HAVE_FIELD_NFS_ARGS_T_FHSIZE) || defined(HAVE_FIELD_NFS_ARGS_T_FH_LEN) +# if defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) /* * Some systems (Irix/bsdi3) have a separate field in nfs_args for * the length of the file handle for NFS V3. They insist that @@ -388,9 +394,9 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ * include the length field. */ NFS_FH_DREF(nap->NFS_FH_FIELD, &(fh3.fh3_u.data)); -# else /* not defined(HAVE_FIELD_NFS_ARGS_T_FHSIZE) || defined(HAVE_FIELD_NFS_ARGS_T_FH_LEN) */ +# else /* not defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) */ NFS_FH_DREF(nap->NFS_FH_FIELD, &fh3); -# endif /* not defined(HAVE_FIELD_NFS_ARGS_T_FHSIZE) || defined(HAVE_FIELD_NFS_ARGS_T_FH_LEN) */ +# endif /* not defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) */ # ifdef MNT2_NFS_OPT_NFSV3 nap->flags |= MNT2_NFS_OPT_NFSV3; # endif /* MNT2_NFS_OPT_NFSV3 */ @@ -401,24 +407,24 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ #endif /* HAVE_FS_NFS3 */ NFS_FH_DREF(nap->NFS_FH_FIELD, &(fhp->v2.fhs_fh)); -#ifdef HAVE_FIELD_NFS_ARGS_T_FHSIZE +#ifdef HAVE_NFS_ARGS_T_FHSIZE # ifdef HAVE_FS_NFS3 if (nfs_version == NFS_VERSION3) nap->fhsize = fh3.fh3_length; else # endif /* HAVE_FS_NFS3 */ nap->fhsize = FHSIZE; -#endif /* HAVE_FIELD_NFS_ARGS_T_FHSIZE */ +#endif /* HAVE_NFS_ARGS_T_FHSIZE */ /* this is the version of the nfs_args structure, not of NFS! */ -#ifdef HAVE_FIELD_NFS_ARGS_T_FH_LEN +#ifdef HAVE_NFS_ARGS_T_FH_LEN # ifdef HAVE_FS_NFS3 if (nfs_version == NFS_VERSION3) nap->fh_len = fh3.fh3_length; else # endif /* HAVE_FS_NFS3 */ nap->fh_len = FHSIZE; -#endif /* HAVE_FIELD_NFS_ARGS_T_FH_LEN */ +#endif /* HAVE_NFS_ARGS_T_FH_LEN */ /************************************************************************/ /*** HOST NAME ***/ @@ -446,14 +452,14 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ #endif /* MNTTAB_OPT_ACTIMEO */ if (acval) { -#ifdef HAVE_FIELD_NFS_ARGS_T_ACREGMIN +#ifdef HAVE_NFS_ARGS_T_ACREGMIN nap->acregmin = acval; /* min ac timeout for reg files (sec) */ nap->acregmax = acval; /* max ac timeout for reg files (sec) */ -#endif /* HAVE_FIELD_NFS_ARGS_T_ACREGMIN */ -#ifdef HAVE_FIELD_NFS_ARGS_T_ACDIRMIN +#endif /* HAVE_NFS_ARGS_T_ACREGMIN */ +#ifdef HAVE_NFS_ARGS_T_ACDIRMIN nap->acdirmin = acval; /* min ac timeout for dirs (sec) */ nap->acdirmax = acval; /* max ac timeout for dirs (sec) */ -#endif /* HAVE_FIELD_NFS_ARGS_T_ACDIRMIN */ +#endif /* HAVE_NFS_ARGS_T_ACDIRMIN */ } else { #ifdef MNTTAB_OPT_ACREGMIN nap->acregmin = hasmntval(mntp, MNTTAB_OPT_ACREGMIN); @@ -509,7 +515,7 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ nap->flags |= MNT2_NFS_OPT_TCP; #endif /* MNT2_NFS_OPT_TCP */ -#ifdef HAVE_FIELD_NFS_ARGS_T_SOTYPE +#ifdef HAVE_NFS_ARGS_T_SOTYPE /* bsdi3 uses this */ if (nfs_proto) { if (STREQ(nfs_proto, "tcp")) @@ -517,9 +523,9 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ else if (STREQ(nfs_proto, "udp")) nap->sotype = SOCK_DGRAM; } -#endif /* HAVE_FIELD_NFS_ARGS_T_SOTYPE */ +#endif /* HAVE_NFS_ARGS_T_SOTYPE */ -#ifdef HAVE_FIELD_NFS_ARGS_T_PROTO +#ifdef HAVE_NFS_ARGS_T_PROTO nap->proto = 0; /* bsdi3 sets this field to zero */ # ifdef IPPROTO_TCP if (nfs_proto) { @@ -529,16 +535,16 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ nap->proto = IPPROTO_UDP; } # endif /* IPPROTO_TCP */ -#endif /* HAVE_FIELD_NFS_ARGS_T_SOTYPE */ +#endif /* HAVE_NFS_ARGS_T_SOTYPE */ -#ifdef HAVE_FIELD_NFS_ARGS_T_VERSION +#ifdef HAVE_NFS_ARGS_T_VERSION # ifdef NFS_ARGSVERSION nap->version = NFS_ARGSVERSION; /* BSDI 3.0 and OpenBSD 2.2 */ # endif /* NFS_ARGSVERSION */ # ifdef DG_MOUNT_NFS_VERSION nap->version = DG_MOUNT_NFS_VERSION; /* dg-ux */ # endif /* DG_MOUNT_NFS_VERSION */ -#endif /* HAVE_FIELD_NFS_ARGS_VERSION */ +#endif /* HAVE_NFS_ARGS_VERSION */ /************************************************************************/ /*** OTHER NFS SOCKET RELATED OPTIONS AND FLAGS ***/ @@ -609,12 +615,16 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ if (nap->rsize) nap->flags |= MNT2_NFS_OPT_RSIZE; #endif /* MNT2_NFS_OPT_RSIZE */ + if (nfs_version == NFS_VERSION && nap->rsize > 8192) + nap->rsize = 8192; nap->wsize = hasmntval(mntp, MNTTAB_OPT_WSIZE); #ifdef MNT2_NFS_OPT_WSIZE if (nap->wsize) nap->flags |= MNT2_NFS_OPT_WSIZE; #endif /* MNT2_NFS_OPT_WSIZE */ + if (nfs_version == NFS_VERSION && nap->wsize > 8192) + nap->wsize = 8192; nap->timeo = hasmntval(mntp, MNTTAB_OPT_TIMEO); #ifdef MNT2_NFS_OPT_TIMEO @@ -720,18 +730,28 @@ compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct sockaddr_ nap->flags |= MNT2_NFS_OPT_MAXGRPS; #endif /* defined(MNT2_NFS_OPT_MAXGRPS) && defined(MNTTAB_OPT_MAXGROUPS) */ -#ifdef HAVE_FIELD_NFS_ARGS_T_OPTSTR +#if defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) + if (hasmntopt(mntp, MNTTAB_OPT_NOLOCK) != NULL) + nap->flags |= MNT2_NFS_OPT_NONLM; +#endif /* defined(MNT2_NFS_OPT_NONLM) && defined(MNTTAB_OPT_NOLOCK) */ + +#if defined(MNT2_NFS_OPT_XLATECOOKIE) && defined(MNTTAB_OPT_XLATECOOKIE) + if (hasmntopt(mntp, MNTTAB_OPT_XLATECOOKIE) != NULL) + nap->flags |= MNT2_NFS_OPT_XLATECOOKIE; +#endif /* defined(MNT2_NFS_OPT_XLATECOOKIE) && defined(MNTTAB_OPT_XLATECOOKIE) */ + +#ifdef HAVE_NFS_ARGS_T_OPTSTR nap->optstr = mntp->mnt_opts; -#endif /* HAVE_FIELD_NFS_ARGS_T_OPTSTR */ +#endif /* HAVE_NFS_ARGS_T_OPTSTR */ /************************************************************************/ /*** FINAL ACTIONS ***/ /************************************************************************/ -#ifdef HAVE_FIELD_NFS_ARGS_T_GFS_FLAGS +#ifdef HAVE_NFS_ARGS_T_GFS_FLAGS /* Ultrix stores generic flags in nfs_args.gfs_flags. */ nap->gfs_flags = genflags; -#endif /* HAVE_FIELD_NFS_ARGS_T_FLAGS */ +#endif /* HAVE_NFS_ARGS_T_FLAGS */ return; /* end of compute_nfs_args() function */ } @@ -869,19 +889,19 @@ print_nfs_args(const nfs_args_t *nap, u_long nfs_version) nbp = nap->syncaddr; plog(XLOG_DEBUG, "NA->syncaddr {netbuf} 0x%x", (int) nbp); kncp = nap->knconf; - plog(XLOG_DEBUG, "NA->knconf->semantics %lu", (unsigned long) kncp->knc_semantics); + plog(XLOG_DEBUG, "NA->knconf->semantics %lu", (u_long) kncp->knc_semantics); plog(XLOG_DEBUG, "NA->knconf->protofmly \"%s\"", kncp->knc_protofmly); plog(XLOG_DEBUG, "NA->knconf->proto \"%s\"", kncp->knc_proto); - plog(XLOG_DEBUG, "NA->knconf->rdev %lu", kncp->knc_rdev); + plog(XLOG_DEBUG, "NA->knconf->rdev %lu", (u_long) kncp->knc_rdev); /* don't print knconf->unused field */ #else /* not HAVE_TRANSPORT_TYPE_TLI */ sap = (struct sockaddr_in *) &nap->addr; plog(XLOG_DEBUG, "NA->addr {sockaddr_in} (len=%d) = \"%s\"", (int) sizeof(struct sockaddr_in), get_hex_string(sizeof(struct sockaddr_in), (const char *)sap)); -#ifdef HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN plog(XLOG_DEBUG, "NA->addr.sin_len = \"%d\"", sap->sin_len); -#endif /* HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN */ +#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ plog(XLOG_DEBUG, "NA->addr.sin_family = \"%d\"", sap->sin_family); plog(XLOG_DEBUG, "NA->addr.sin_port = \"%d\"", sap->sin_port); plog(XLOG_DEBUG, "NA->addr.sin_addr = \"%s\"", @@ -889,22 +909,22 @@ print_nfs_args(const nfs_args_t *nap, u_long nfs_version) #endif /* not HAVE_TRANSPORT_TYPE_TLI */ plog(XLOG_DEBUG, "NA->hostname = \"%s\"", nap->hostname ? nap->hostname : "null"); -#ifdef HAVE_FIELD_NFS_ARGS_T_NAMLEN +#ifdef HAVE_NFS_ARGS_T_NAMLEN plog(XLOG_DEBUG, "NA->namlen = %d", nap->namlen); -#endif /* HAVE_FIELD_NFS_ARGS_T_NAMLEN */ +#endif /* HAVE_NFS_ARGS_T_NAMLEN */ #ifdef MNT2_NFS_OPT_FSNAME plog(XLOG_DEBUG, "NA->fsname = \"%s\"", nap->fsname ? nap->fsname : "null"); #endif /* MNT2_NFS_OPT_FSNAME */ -#ifdef HAVE_FIELD_NFS_ARGS_T_FHSIZE +#ifdef HAVE_NFS_ARGS_T_FHSIZE plog(XLOG_DEBUG, "NA->fhsize = %d", nap->fhsize); fhlen = nap->fhsize; -#endif /* HAVE_FIELD_NFS_ARGS_T_FHSIZE */ -#ifdef HAVE_FIELD_NFS_ARGS_T_FH_LEN +#endif /* HAVE_NFS_ARGS_T_FHSIZE */ +#ifdef HAVE_NFS_ARGS_T_FH_LEN plog(XLOG_DEBUG, "NA->fh_len = %d", nap->fh_len); fhlen = nap->fh_len; -#endif /* HAVE_FIELD_NFS_ARGS_T_FH_LEN */ +#endif /* HAVE_NFS_ARGS_T_FH_LEN */ /* * XXX: need to figure out how to correctly print file handles, @@ -915,32 +935,32 @@ print_nfs_args(const nfs_args_t *nap, u_long nfs_version) plog(XLOG_DEBUG, "NA->filehandle = \"%s\"", get_hex_string(fhlen, (const char *) &nap->NFS_FH_FIELD)); -#ifdef HAVE_FIELD_NFS_ARGS_T_SOTYPE +#ifdef HAVE_NFS_ARGS_T_SOTYPE plog(XLOG_DEBUG, "NA->sotype = %d", nap->sotype); -#endif /* HAVE_FIELD_NFS_ARGS_T_SOTYPE */ -#ifdef HAVE_FIELD_NFS_ARGS_T_PROTO +#endif /* HAVE_NFS_ARGS_T_SOTYPE */ +#ifdef HAVE_NFS_ARGS_T_PROTO plog(XLOG_DEBUG, "NA->proto = %d", (int) nap->proto); -#endif /* HAVE_FIELD_NFS_ARGS_T_PROTO */ -#ifdef HAVE_FIELD_NFS_ARGS_T_VERSION +#endif /* HAVE_NFS_ARGS_T_PROTO */ +#ifdef HAVE_NFS_ARGS_T_VERSION plog(XLOG_DEBUG, "NA->version = %d", nap->version); -#endif /* HAVE_FIELD_NFS_ARGS_T_VERSION */ +#endif /* HAVE_NFS_ARGS_T_VERSION */ plog(XLOG_DEBUG, "NA->flags = 0x%x", (int) nap->flags); plog(XLOG_DEBUG, "NA->rsize = %d", (int) nap->rsize); plog(XLOG_DEBUG, "NA->wsize = %d", (int) nap->wsize); -#ifdef HAVE_FIELD_NFS_ARGS_T_BSIZE +#ifdef HAVE_NFS_ARGS_T_BSIZE plog(XLOG_DEBUG, "NA->bsize = %d", nap->bsize); -#endif /* HAVE_FIELD_NFS_ARGS_T_BSIZE */ +#endif /* HAVE_NFS_ARGS_T_BSIZE */ plog(XLOG_DEBUG, "NA->timeo = %d", (int) nap->timeo); plog(XLOG_DEBUG, "NA->retrans = %d", (int) nap->retrans); -#ifdef HAVE_FIELD_NFS_ARGS_T_ACREGMIN +#ifdef HAVE_NFS_ARGS_T_ACREGMIN plog(XLOG_DEBUG, "NA->acregmin = %d", (int) nap->acregmin); plog(XLOG_DEBUG, "NA->acregmax = %d", (int) nap->acregmax); plog(XLOG_DEBUG, "NA->acdirmin = %d", (int) nap->acdirmin); plog(XLOG_DEBUG, "NA->acdirmax = %d", (int) nap->acdirmax); -#endif /* HAVE_FIELD_NFS_ARGS_T_ACREGMIN */ +#endif /* HAVE_NFS_ARGS_T_ACREGMIN */ #ifdef MNTTAB_OPT_SYMTTL plog(XLOG_DEBUG, "NA->symttl = %d", nap->symttl); #endif /* MNTTAB_OPT_SYMTTL */ diff --git a/dist/am-utils/libamu/wire.c b/dist/am-utils/libamu/wire.c index 4491648ab327..9275706b6bfa 100644 --- a/dist/am-utils/libamu/wire.c +++ b/dist/am-utils/libamu/wire.c @@ -1,7 +1,7 @@ -/* $NetBSD: wire.c,v 1.4 2001/05/13 18:07:00 veego Exp $ */ +/* $NetBSD: wire.c,v 1.5 2002/11/29 23:06:26 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: wire.c,v 1.8.2.5 2001/01/10 03:23:41 ezk Exp + * Id: wire.c,v 1.17 2002/02/02 20:59:05 ezk Exp * */ @@ -62,6 +61,7 @@ #include #include + #ifdef HAVE_IFADDRS_H #include #endif /* HAVE_IFADDRS_H */ @@ -281,16 +281,16 @@ int islocalnet(u_long addr) { addrlist *al; -#ifdef DEBUG - char buf[16]; -#endif /* DEBUG */ for (al = localnets; al; al = al->ip_next) if (((addr ^ al->ip_addr) & al->ip_mask) == 0) return TRUE; #ifdef DEBUG + { + char buf[16]; plog(XLOG_INFO, "%s is on a remote network", inet_dquad(buf, addr)); + } #endif /* DEBUG */ return FALSE; @@ -306,9 +306,51 @@ is_network_member(const char *net) { addrlist *al; - for (al = localnets; al; al = al->ip_next) - if (STREQ(net, al->ip_net_name) || STREQ(net, al->ip_net_num)) - return TRUE; + /* + * If the network name string does not contain a '/', use old behavior. + * If it does contain a '/' then interpret the string as a network/netmask + * pair. If "netmask" doesn't exist, use the interface's own netmask. + * Also support fully explicit netmasks such as 255.255.255.0 as well as + * bit-length netmask such as /24 (hex formats such 0xffffff00 work too). + */ + if (strchr(net, '/') == NULL) { + for (al = localnets; al; al = al->ip_next) + if (STREQ(net, al->ip_net_name) || STREQ(net, al->ip_net_num)) + return TRUE; + } else { + char *netstr = strdup(net), *maskstr; + u_long netnum, masknum = 0; + maskstr = strchr(netstr, '/'); + maskstr++; + maskstr[-1] = '\0'; /* null terminate netstr */ + if (*maskstr == '\0') /* if empty string, make it NULL */ + maskstr = NULL; + /* check if netmask uses a dotted-quad or bit-length, or not defined at all */ + if (maskstr) { + if (strchr(maskstr, '.')) { + masknum = inet_addr(maskstr); + if (masknum < 0) /* can be invalid (-1) or all-1s */ + masknum = 0xffffffff; + } else if (NSTRCEQ(maskstr, "0x", 2)) { + masknum = strtoul(maskstr, NULL, 16); + } else { + int bits = atoi(maskstr); + if (bits < 0) + bits = 0; + if (bits > 32) + bits = 32; + masknum = 0xffffffff << (32-bits); + } + } + netnum = inet_addr(netstr); /* not checking return value, b/c -1 (0xffffffff) is valid */ + XFREE(netstr); /* netstr not needed any longer */ + + /* now check against each local interface */ + for (al = localnets; al; al = al->ip_next) { + if ((al->ip_addr & (maskstr ? masknum : al->ip_mask)) == netnum) + return TRUE; + } + } return FALSE; } @@ -320,22 +362,22 @@ getwire(char **name1, char **number1) { addrlist *al = NULL, *tail = NULL; struct ifaddrs *ifaddrs, *ifap; -#ifndef HAVE_FIELD_STRUCT_IFADDRS_IFA_NEXT +#ifndef HAVE_STRUCT_IFADDRS_IFA_NEXT int count = 0, i; -#endif /* not HAVE_FIELD_STRUCT_IFADDRS_IFA_NEXT */ +#endif /* not HAVE_STRUCT_IFADDRS_IFA_NEXT */ ifaddrs = NULL; -#ifdef HAVE_FIELD_STRUCT_IFADDRS_IFA_NEXT +#ifdef HAVE_STRUCT_IFADDRS_IFA_NEXT if (getifaddrs(&ifaddrs) < 0) goto out; for (ifap = ifaddrs; ifap != NULL; ifap = ifap->ifa_next) { -#else /* not HAVE_FIELD_STRUCT_IFADDRS_IFA_NEXT */ +#else /* not HAVE_STRUCT_IFADDRS_IFA_NEXT */ if (getifaddrs(&ifaddrs, &count) < 0) goto out; for (i = 0,ifap = ifaddrs; i < count; ifap++, i++) { -#endif /* HAVE_FIELD_STRUCT_IFADDRS_IFA_NEXT */ +#endif /* HAVE_STRUCT_IFADDRS_IFA_NEXT */ if (!ifap || !ifap->ifa_addr || ifap->ifa_addr->sa_family != AF_INET) continue; @@ -379,11 +421,11 @@ out: #else /* not HAVE_GETIFADDRS */ -#if defined(HAVE_FIELD_STRUCT_IFREQ_IFR_ADDR) && defined(HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN) +#if defined(HAVE_STRUCT_IFREQ_IFR_ADDR) && defined(HAVE_STRUCT_SOCKADDR_SA_LEN) # define SIZE(ifr) (MAX((ifr)->ifr_addr.sa_len, sizeof((ifr)->ifr_addr)) + sizeof(ifr->ifr_name)) -#else /* not defined(HAVE_FIELD_STRUCT_IFREQ_IFR_ADDR) && defined(HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN) */ +#else /* not defined(HAVE_STRUCT_IFREQ_IFR_ADDR) && defined(HAVE_STRUCT_SOCKADDR_SA_LEN) */ # define SIZE(ifr) sizeof(struct ifreq) -#endif /* not defined(HAVE_FIELD_STRUCT_IFREQ_IFR_ADDR) && defined(HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN) */ +#endif /* not defined(HAVE_STRUCT_IFREQ_IFR_ADDR) && defined(HAVE_STRUCT_SOCKADDR_SA_LEN) */ #define clist (ifc.ifc_ifcu.ifcu_req) #define count (ifc.ifc_len/sizeof(struct ifreq)) diff --git a/dist/am-utils/libamu/xutil.c b/dist/am-utils/libamu/xutil.c index a27b41117f06..07b7ce2b552c 100644 --- a/dist/am-utils/libamu/xutil.c +++ b/dist/am-utils/libamu/xutil.c @@ -1,7 +1,7 @@ -/* $NetBSD: xutil.c,v 1.5 2001/05/13 18:07:00 veego Exp $ */ +/* $NetBSD: xutil.c,v 1.6 2002/11/29 23:06:26 christos Exp $ */ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2002 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. @@ -38,9 +38,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * Id: xutil.c,v 1.11.2.6 2001/01/10 03:23:41 ezk Exp + * Id: xutil.c,v 1.23 2002/06/23 01:05:41 ib42 Exp * */ @@ -62,9 +61,7 @@ static char am_hostname[MAXHOSTNAMELEN + 1] = "unknown"; /* Hostname */ pid_t am_mypid = -1; /* process ID */ serv_state amd_state; /* amd's state */ int foreground = 1; /* 1 == this is the top-level server */ -#ifdef DEBUG int debug_flags = 0; -#endif /* DEBUG */ #ifdef HAVE_SYSLOG int syslogging; @@ -82,11 +79,10 @@ static int orig_mem_bytes; #endif /* DEBUG_MEM */ /* forward definitions */ +/* for GCC format string auditing */ static void real_plog(int lvl, const char *fmt, va_list vargs) __attribute__((__format__(__printf__, 2, 0))); -/* for GCC format string auditing */ -static const char *expand_error(const char *f, char *e, int maxlen) - __attribute__((__format_arg__(1))); + #ifdef DEBUG /* @@ -227,7 +223,8 @@ voidp xrealloc(voidp ptr, int len) { #if defined(DEBUG) && defined(DEBUG_MEM) - amuDebug(D_MEM) plog(XLOG_DEBUG, "Reallocated size %d; block %#x", len, ptr); + amuDebug(D_MEM) + plog(XLOG_DEBUG, "Reallocated size %d; block %#x", len, ptr); #endif /* defined(DEBUG) && defined(DEBUG_MEM) */ if (len == 0) @@ -346,26 +343,24 @@ show_time_host_and_name(int lvl) static time_t last_t = 0; static char *last_ctime = 0; time_t t; -#ifdef HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) && defined(DEBUG) struct timespec ts; -#endif /* HAVE_CLOCK_GETTIME */ +#endif /* defined(HAVE_CLOCK_GETTIME) && defined(DEBUG) */ char nsecs[11] = ""; /* '.' + 9 digits + '\0' */ char *sev; -#ifdef HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) && defined(DEBUG) /* * Some systems (AIX 4.3) seem to implement clock_gettime() as stub * returning ENOSYS. */ if (clock_gettime(CLOCK_REALTIME, &ts) == 0) { t = ts.tv_sec; -#ifdef DEBUG amuDebug(D_HRTIME) sprintf(nsecs, ".%09ld", ts.tv_nsec); -#endif /* DEBUG */ } else -#endif /* HAVE_CLOCK_GETTIME */ +#endif /* defined(HAVE_CLOCK_GETTIME) && defined(DEBUG) */ t = clocktime(); if (t != last_t) { @@ -879,9 +874,7 @@ going_down(int rc) if (foreground) { plog(XLOG_INFO, "Finishing with status %d", rc); } else { -#ifdef DEBUG dlog("background process exiting with status %d", rc); -#endif /* DEBUG */ } exit(rc); diff --git a/dist/am-utils/mk-amd-map/mk-amd-map.8 b/dist/am-utils/mk-amd-map/mk-amd-map.8 index 76e53722b328..fe31d270f860 100644 --- a/dist/am-utils/mk-amd-map/mk-amd-map.8 +++ b/dist/am-utils/mk-amd-map/mk-amd-map.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: mk-amd-map.8,v 1.2 2001/12/18 09:31:48 wiz Exp $ +.\" $NetBSD: mk-amd-map.8,v 1.3 2002/11/29 23:06:26 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 Erez Zadok .\" Copyright (c) 1993 Jan-Simon Pendry .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -35,7 +35,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)mk-amd-map.8 8.1 (Berkeley) 6/28/93 -.\" Id: mk-amd-map.8,v 1.3.2.1 2001/01/10 03:23:42 ezk Exp +.\" Id: mk-amd-map.8,v 1.5 2002/01/07 07:36:35 ezk Exp .\" .TH MK-AMD-MAP 8 "June 28, 1993" .SH NAME diff --git a/dist/am-utils/scripts/amd.conf.5 b/dist/am-utils/scripts/amd.conf.5 index 6d4c097418f9..7eb11d8e2b0e 100644 --- a/dist/am-utils/scripts/amd.conf.5 +++ b/dist/am-utils/scripts/amd.conf.5 @@ -1,7 +1,7 @@ -.\" $NetBSD: amd.conf.5,v 1.5 2001/12/18 09:31:49 wiz Exp $ +.\" $NetBSD: amd.conf.5,v 1.6 2002/11/29 23:06:27 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -40,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" Id: amd.conf.5,v 1.7.2.3 2001/04/07 00:47:45 ib42 Exp +.\" Id: amd.conf.5,v 1.15 2002/06/22 20:52:45 ezk Exp .\" .TH AMD.CONF 5 "7 August 1997" .SH NAME @@ -168,7 +168,9 @@ distributed maps in several locations as needed. .TP .BR arch " (string, default to compiled in value)" -Allows you to override the value of the +Same as the +.B \-A +option to amd. Allows you to override the value of the .I arch amd variable. @@ -334,13 +336,19 @@ options by running amd \-H. Possible values are: .fi .TP -.BR nfs_proto " (numeric, default to trying version 3 then 2)" -By default, amd tries version 3 and then version 2. This option forces the -overall NFS protocol used to version 3 or 2. It overrides what is in the -amd maps, and is useful when amd is compiled with NFSv3 support that may not -be stable. With this option you can turn off the complete usage of NFSv3 -dynamically (without having to recompile amd) until such time as NFSv3 -support is desired again. +.BR map_reload_interval " (numeric, default=3600)" +The number of seconds that amd will wait before it checks to see if any maps +have changed at their source (NIS servers, LDAP servers, files, etc.). Amd +will reload only those maps that have changed. + +.TP +.BR nfs_proto " (string, default to trying version tcp then udp)" +By default, amd tries TCP and then UDP. This option forces the overall NFS +protocol used to TCP or UDP. It overrides what is in the amd maps, and is +useful when amd is compiled with NFSv3 support that may not be stable. With +this option you can turn off the complete usage of NFSv3 dynamically +(without having to recompile amd) until such time as NFSv3 support is +desired again. .TP .BR nfs_retransmit_counter " (numeric, default=11)" @@ -373,13 +381,13 @@ parameters change the overall retry interval. Too long an interval gives poor interactive response; too short an interval causes excessive retries. .TP -.BR nfs_vers " (string, default to trying version tcp then udp)" -By default, amd tries TCP and then UDP. This option forces the overall NFS -protocol used to TCP or UDP. It overrides what is in the amd maps, and is -useful when amd is compiled with NFSv3 support that may not be stable. With -this option you can turn off the complete usage of NFSv3 dynamically -(without having to recompile amd) until such time as NFSv3 support is -desired again. +.BR nfs_vers " (numeric, default to trying version 3 then 2)" +By default, amd tries version 3 and then version 2. This option forces the +overall NFS protocol used to version 3 or 2. It overrides what is in the +amd maps, and is useful when amd is compiled with NFSv3 support that may not +be stable. With this option you can turn off the complete usage of NFSv3 +dynamically (without having to recompile amd) until such time as NFSv3 +support is desired again. .TP .BR nis_domain " (string, default to local NIS domain name)" @@ -435,6 +443,8 @@ option to amd. If "yes", lock the running executable pages of amd into memory. To improve amd's performance, systems that support the .BR plock (3) +or +.BR mlockall (2) call can lock the amd process into memory. This way there is less chance it the operating system will schedule, page out, and swap the amd process as needed. This improves amd's performance, at the cost of reserving the diff --git a/dist/am-utils/scripts/automount2amd.8 b/dist/am-utils/scripts/automount2amd.8 index a513c7c4f362..7c7f1c79b9e4 100644 --- a/dist/am-utils/scripts/automount2amd.8 +++ b/dist/am-utils/scripts/automount2amd.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: automount2amd.8,v 1.2 2001/12/18 09:31:49 wiz Exp $ +.\" $NetBSD: automount2amd.8,v 1.3 2002/11/29 23:06:27 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -40,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" Id: automount2amd.8,v 1.2.2.1 2001/01/10 03:23:43 ezk Exp +.\" Id: automount2amd.8,v 1.4 2002/01/07 07:36:35 ezk Exp .\" .TH AUTOMOUNT2AMD 8L "24 May 1993" .SH NAME diff --git a/dist/am-utils/scripts/expn.in b/dist/am-utils/scripts/expn.in index 6581e1ace07e..4f796227fe5f 100755 --- a/dist/am-utils/scripts/expn.in +++ b/dist/am-utils/scripts/expn.in @@ -15,7 +15,7 @@ $SOCK_STREAM = &SOCK_STREAM; # system requirements: # must have 'nslookup' and 'hostname' programs. -# Header: /proj/bank/cvsroot/am-utils/scripts/expn.in,v 1.2.2.1 2000/06/14 01:58:48 ionut Exp +# Header: /proj/bank/cvsroot/am-utils/scripts/expn.in,v 1.4 2000/11/05 13:03:14 ib42 Exp # TODO: # less magic should apply to command-line addresses diff --git a/dist/am-utils/wire-test/wire-test.8 b/dist/am-utils/wire-test/wire-test.8 index 3fa4097d9f66..392361eb5dc2 100644 --- a/dist/am-utils/wire-test/wire-test.8 +++ b/dist/am-utils/wire-test/wire-test.8 @@ -1,7 +1,7 @@ -.\" $NetBSD: wire-test.8,v 1.4 2001/12/18 09:31:49 wiz Exp $ +.\" $NetBSD: wire-test.8,v 1.5 2002/11/29 23:06:27 christos Exp $ .\" .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2002 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. @@ -40,7 +40,7 @@ .\" .\" %W% (Berkeley) %G% .\" -.\" Id: wire-test.8,v 1.3.2.2 2001/01/10 03:23:43 ezk Exp +.\" Id: wire-test.8,v 1.6 2002/01/07 07:36:35 ezk Exp .\" .TH WIRE-TEST 8 "26 Feb 1993" .SH NAME