diff options
author | Peter Valchev <pvalchev@cvs.openbsd.org> | 2002-08-03 08:29:33 +0000 |
---|---|---|
committer | Peter Valchev <pvalchev@cvs.openbsd.org> | 2002-08-03 08:29:33 +0000 |
commit | 9a50ceafc10893c30ce6a3fa35b0aa0ace4f45a2 (patch) | |
tree | d511173eb6b0050f548c64e8438b6fa58294ad90 /usr.sbin | |
parent | 2424909aa4f4005db0867528ed4ee0ebc3c31bd7 (diff) |
various KNF and code cleanup/simplification, parts checked by millert/deraadt
Diffstat (limited to 'usr.sbin')
44 files changed, 975 insertions, 1432 deletions
diff --git a/usr.sbin/amd/amd/afs_ops.c b/usr.sbin/amd/amd/afs_ops.c index 08ca24f72b7..4637c159fea 100644 --- a/usr.sbin/amd/amd/afs_ops.c +++ b/usr.sbin/amd/amd/afs_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: afs_ops.c,v 1.6 2002/07/18 02:03:00 deraadt Exp $ */ +/* $OpenBSD: afs_ops.c,v 1.7 2002/08/03 08:29:31 pvalchev Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -71,11 +71,11 @@ typedef nfs_fh fhandle_t; /* * AFS needs nothing in particular. */ -static char *afs_match P((am_opts *fo)); -static char *afs_match(fo) -am_opts *fo; +static char * +afs_match(am_opts *fo) { char *p = fo->opt_rfs; + if (!fo->opt_rfs) { plog(XLOG_USER, "auto: no mount point named (rfs:=)"); return 0; @@ -103,10 +103,8 @@ am_opts *fo; * the necessary NFS parameters to be given to the * kernel so that it will talk back to us. */ -static int mount_toplvl P((char *dir, char *opts)); -static int mount_toplvl(dir, opts) -char *dir; -char *opts; +static int +mount_toplvl(char *dir, char *opts) { struct nfs_args nfs_args; struct mntent mnt; @@ -241,9 +239,8 @@ char *opts; return mount_fs(&mnt, flags, (caddr_t) &nfs_args, retry, type); } -static void afs_mkcacheref P((mntfs *mf)); -static void afs_mkcacheref(mf) -mntfs *mf; +static void +afs_mkcacheref(mntfs *mf) { /* * Build a new map cache for this node, or re-use @@ -261,9 +258,8 @@ mntfs *mf; /* * Mount the root... */ -static int root_mount P((am_node *mp)); -static int root_mount(mp) -am_node *mp; +static int +root_mount(am_node *mp) { mntfs *mf = mp->am_mnt; @@ -277,9 +273,8 @@ am_node *mp; /* * Mount a sub-mount */ -static int afs_mount P((am_node *mp)); -static int afs_mount(mp) -am_node *mp; +static int +afs_mount(am_node *mp) { mntfs *mf = mp->am_mnt; @@ -336,9 +331,8 @@ am_node *mp; /* * Mount the top-level */ -static int toplvl_mount P((am_node *mp)); -static int toplvl_mount(mp) -am_node *mp; +static int +toplvl_mount(am_node *mp) { mntfs *mf = mp->am_mnt; struct stat stb; @@ -392,9 +386,8 @@ am_node *mp; return 0; } -static void toplvl_mounted P((mntfs *mf)); -static void toplvl_mounted(mf) -mntfs *mf; +static void +toplvl_mounted(mntfs *mf) { afs_mkcacheref(mf); } @@ -403,10 +396,8 @@ mntfs *mf; /* * Create a reference to a union'ed entry */ -static int create_union_node P((char *dir, voidp arg)); -static int create_union_node(dir, arg) -char *dir; -voidp arg; +static int +create_union_node(char *dir, voidp arg) { if (strcmp(dir, "/defaults") != 0) { int error = 0; @@ -420,9 +411,8 @@ voidp arg; return 0; } -static void union_mounted P((mntfs *mf)); -static void union_mounted(mf) -mntfs *mf; +static void +union_mounted(mntfs *mf) { int i; @@ -437,7 +427,7 @@ mntfs *mf; if (mp && mp->am_mnt == mf) { /* return value from create_union_node is ignored by mapc_keyiter */ (void) mapc_keyiter((mnt_map *) mp->am_mnt->mf_private, - (void (*)P((char*,void*))) create_union_node, mp); + (void (*)(char *, void *)) create_union_node, mp); break; } } @@ -458,9 +448,8 @@ mntfs *mf; /* * Unmount an automount sub-node */ -static int afs_umount P((am_node *mp)); -static int afs_umount(mp) -am_node *mp; +static int +afs_umount(am_node *mp) { return 0; } @@ -468,9 +457,8 @@ am_node *mp; /* * Unmount a top-level automount node */ -static int toplvl_umount P((am_node *mp)); -static int toplvl_umount(mp) -am_node *mp; +static int +toplvl_umount(am_node *mp) { int error; @@ -505,9 +493,8 @@ again: /* * Unmount an automount node */ -static void afs_umounted P((am_node *mp)); -static void afs_umounted(mp) -am_node *mp; +static void +afs_umounted(am_node *mp) { /* * If this is a pseudo-directory then just adjust the link count @@ -554,9 +541,8 @@ struct continuation { /* * Discard an old continuation */ -static void free_continuation P((struct continuation *cp)); -static void free_continuation(cp) -struct continuation *cp; +static void +free_continuation(struct continuation *cp) { if (cp->callout) untimeout(cp->callout); @@ -569,15 +555,14 @@ struct continuation *cp; free((voidp) cp); } -static int afs_bgmount P((struct continuation*, int)); +static int afs_bgmount(struct continuation *, int); /* * Discard the underlying mount point and replace * with a reference to an error filesystem. */ -static void assign_error_mntfs P((am_node *mp)); -static void assign_error_mntfs(mp) -am_node *mp; +static void +assign_error_mntfs(am_node *mp) { if (mp->am_error > 0) { /* @@ -611,11 +596,8 @@ am_node *mp; * the task notifier when a background mount attempt * completes. */ -static void afs_cont P((int rc, int term, voidp closure)); -static void afs_cont(rc, term, closure) -int rc; -int term; -voidp closure; +static void +afs_cont(int rc, int term, voidp closure) { struct continuation *cp = (struct continuation *) closure; mntfs *mf = cp->mp->am_mnt; @@ -682,11 +664,8 @@ voidp closure; * Retry a mount */ /*ARGSUSED*/ -static void afs_retry P((int rc, int term, voidp closure)); -static void afs_retry(rc, term, closure) -int rc; -int term; -voidp closure; +static void +afs_retry(int rc, int term, voidp closure) { struct continuation *cp = (struct continuation *) closure; int error = 0; @@ -722,9 +701,8 @@ voidp closure; * Try to mount a file system. Can be called * directly or in a sub-process by run_task */ -static int try_mount P((voidp mvp)); -static int try_mount(mvp) -voidp mvp; +static int +try_mount(voidp mvp) { /* * Mount it! @@ -817,10 +795,8 @@ For each location: endfor */ -static int afs_bgmount P((struct continuation *cp, int mpe)); -static int afs_bgmount(cp, mpe) -struct continuation *cp; -int mpe; +static int +afs_bgmount(struct continuation *cp, int mpe) { mntfs *mf = cp->mp->am_mnt; /* Current mntfs */ mntfs *mf_retry = 0; /* First mntfs which needed retrying */ @@ -1167,12 +1143,8 @@ int mpe; /* * Automount interface to RPC lookup routine */ -static am_node *afs_lookuppn P((am_node *mp, char *fname, int *error_return, int op)); -static am_node *afs_lookuppn(mp, fname, error_return, op) -am_node *mp; -char *fname; -int *error_return; -int op; +static am_node * +afs_lookuppn(am_node *mp, char *fname, int *error_return, int op) { #define ereturn(x) { *error_return = x; return 0; } @@ -1565,9 +1537,8 @@ in_progrss: * Locate next node in sibling list which is mounted * and is not an error node. */ -static am_node *next_nonerror_node P((am_node *xp)); -static am_node *next_nonerror_node(xp) -am_node *xp; +static am_node * +next_nonerror_node(am_node *xp) { mntfs *mf; @@ -1589,13 +1560,9 @@ am_node *xp; return xp; } -static int afs_readdir P((am_node *mp, nfscookie cookie, struct dirlist *dp, struct entry *ep, int count)); -static int afs_readdir(mp, cookie, dp, ep, count) -am_node *mp; -nfscookie cookie; -struct dirlist *dp; -struct entry *ep; -int count; +static int +afs_readdir(am_node *mp, nfscookie cookie, struct dirlist *dp, + struct entry *ep, int count) { unsigned int gen = *(unsigned int*) cookie; am_node *xp; @@ -1708,10 +1675,8 @@ int count; } -static am_node *dfs_readlink P((am_node *mp, int *error_return)); -static am_node *dfs_readlink(mp, error_return) -am_node *mp; -int *error_return; +static am_node * +dfs_readlink(am_node *mp, int *error_return) { am_node *xp; int rc = 0; diff --git a/usr.sbin/amd/amd/am_ops.c b/usr.sbin/amd/amd/am_ops.c index 415ee6aba56..8d79aa97a62 100644 --- a/usr.sbin/amd/amd/am_ops.c +++ b/usr.sbin/amd/amd/am_ops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)am_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: am_ops.c,v 1.3 2002/06/11 05:29:54 itojun Exp $ + * $Id: am_ops.c,v 1.4 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -76,9 +76,8 @@ static am_ops *vops[] = { 0 }; -void ops_showfstypes P((FILE *fp)); -void ops_showfstypes(fp) -FILE *fp; +void +ops_showfstypes(FILE *fp) { struct am_ops **ap; int l = 0; @@ -98,13 +97,9 @@ FILE *fp; * Construct an amd-style line and call the * normal amd matcher. */ -am_ops *sunos4_match(fo, key, g_key, path, keym, map) -am_opts *fo; -char *key; -char *g_key; -char *path; -char *keym; -char *map; +am_ops * +sunos4_match(am_opts *fo, char *key, char *g_key, char *path, + char *keym, char *map) { char *host = key; char *fs = strchr(host, ':'); @@ -121,13 +116,9 @@ char *map; #endif #endif /* SUNOS4_COMPAT */ -am_ops *ops_match(fo, key, g_key, path, keym, map) -am_opts *fo; -char *key; -char *g_key; -char *path; -char *keym; -char *map; +am_ops * +ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, + char *map) { am_ops **vp; am_ops *rop = 0; diff --git a/usr.sbin/amd/amd/amd.c b/usr.sbin/amd/amd/amd.c index 076495c86d9..0c89d2087dc 100644 --- a/usr.sbin/amd/amd/amd.c +++ b/usr.sbin/amd/amd/amd.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amd.c 8.1 (Berkeley) 6/6/93 - * $Id: amd.c,v 1.9 2002/07/18 00:50:23 pvalchev Exp $ + * $Id: amd.c,v 1.10 2002/08/03 08:29:31 pvalchev Exp $ */ #ifndef lint @@ -91,7 +91,8 @@ int orig_umask; * SIGINT - tells amd to do a full shutdown, including unmounting all filesystem. * SIGTERM - tells amd to shutdown now. Just unmounts the automount nodes. */ -static void sigterm(int sig) +static void +sigterm(int sig) { #ifdef SYS5_SIGNALS signal(sig, sigterm); @@ -119,7 +120,8 @@ static void sigterm(int sig) * When a SIGHUP arrives it schedules a call to mapc_reload */ /*ARGSUSED*/ -static void sighup(int sig) +static void +sighup(int sig) { #ifdef SYS5_SIGNALS signal(sig, sighup); @@ -137,12 +139,14 @@ static void sighup(int sig) } /*ARGSUSED*/ -static void parent_exit(int sig) +static void +parent_exit(int sig) { exit(0); } -static pid_t daemon_mode(P_void) +static pid_t +daemon_mode(P_void) { pid_t bgpid; diff --git a/usr.sbin/amd/amd/amq_subr.c b/usr.sbin/amd/amd/amq_subr.c index b1407866af0..0e7453ddd4a 100644 --- a/usr.sbin/amd/amd/amq_subr.c +++ b/usr.sbin/amd/amd/amq_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq_subr.c 8.1 (Berkeley) 6/6/93 - * $Id: amq_subr.c,v 1.7 2002/07/18 02:03:00 deraadt Exp $ + * $Id: amq_subr.c,v 1.8 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -49,9 +49,7 @@ /*ARGSUSED*/ voidp -amqproc_null_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_null_1(voidp argp, struct svc_req *rqstp) { static char res; @@ -63,11 +61,10 @@ struct svc_req *rqstp; */ /*ARGSUSED*/ amq_mount_tree_p * -amqproc_mnttree_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_mnttree_1(voidp argp, struct svc_req *rqstp) { static am_node *mp; + mp = find_ap(*(char **) argp); return (amq_mount_tree_p *) ∓ } @@ -77,11 +74,10 @@ struct svc_req *rqstp; */ /*ARGSUSED*/ voidp -amqproc_umnt_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_umnt_1(voidp argp, struct svc_req *rqstp) { static char res; + am_node *mp = find_ap(*(char **) argp); if (mp) forcibly_timeout_mp(mp); @@ -94,9 +90,7 @@ struct svc_req *rqstp; */ /*ARGSUSED*/ amq_mount_stats * -amqproc_stats_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_stats_1(voidp argp, struct svc_req *rqstp) { return (amq_mount_stats *) &amd_stats; } @@ -106,9 +100,7 @@ struct svc_req *rqstp; */ /*ARGSUSED*/ amq_mount_tree_list * -amqproc_export_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_export_1(voidp argp, struct svc_req *rqstp) { static amq_mount_tree_list aml; @@ -119,9 +111,7 @@ struct svc_req *rqstp; } int * -amqproc_setopt_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_setopt_1(voidp argp, struct svc_req *rqstp) { static int rc; @@ -165,11 +155,9 @@ struct svc_req *rqstp; } amq_mount_info_list * -amqproc_getmntfs_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_getmntfs_1(voidp argp, struct svc_req *rqstp) { -extern qelem mfhead; + extern qelem mfhead; return (amq_mount_info_list *) &mfhead; /* XXX */ } @@ -245,9 +233,7 @@ struct svc_req *rqstp; * Disable "amq -M" functionality since it is inherently insecure. */ int * -amqproc_mount_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_mount_1(voidp argp, struct svc_req *rqstp) { static int rc; char *s = *(amq_string *) argp; @@ -260,11 +246,10 @@ struct svc_req *rqstp; #endif amq_string * -amqproc_getvers_1(argp, rqstp) -voidp argp; -struct svc_req *rqstp; +amqproc_getvers_1(voidp argp, struct svc_req *rqstp) { -static amq_string res; + static amq_string res; + res = version; return &res; } @@ -273,9 +258,7 @@ static amq_string res; * XDR routines. */ bool_t -xdr_amq_string(xdrs, objp) - XDR *xdrs; - amq_string *objp; +xdr_amq_string(XDR *xdrs, amq_string *objp) { if (!xdr_string(xdrs, objp, AMQ_STRLEN)) { return (FALSE); @@ -284,9 +267,7 @@ xdr_amq_string(xdrs, objp) } bool_t -xdr_amq_setopt(xdrs, objp) - XDR *xdrs; - amq_setopt *objp; +xdr_amq_setopt(XDR *xdrs, amq_setopt *objp) { if (!xdr_enum(xdrs, (enum_t *)&objp->as_opt)) { return (FALSE); @@ -301,9 +282,7 @@ xdr_amq_setopt(xdrs, objp) * More XDR routines - Should be used for OUTPUT ONLY. */ bool_t -xdr_amq_mount_tree_node(xdrs, objp) - XDR *xdrs; - amq_mount_tree *objp; +xdr_amq_mount_tree_node(XDR *xdrs, amq_mount_tree *objp) { am_node *mp = (am_node *) objp; @@ -345,9 +324,7 @@ xdr_amq_mount_tree_node(xdrs, objp) } bool_t -xdr_amq_mount_subtree(xdrs, objp) - XDR *xdrs; - amq_mount_tree *objp; +xdr_amq_mount_subtree(XDR *xdrs, amq_mount_tree *objp) { am_node *mp = (am_node *) objp; @@ -364,9 +341,7 @@ xdr_amq_mount_subtree(xdrs, objp) } bool_t -xdr_amq_mount_tree(xdrs, objp) - XDR *xdrs; - amq_mount_tree *objp; +xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp) { am_node *mp = (am_node *) objp; am_node *mnil = 0; @@ -384,9 +359,7 @@ xdr_amq_mount_tree(xdrs, objp) } bool_t -xdr_amq_mount_tree_p(xdrs, objp) - XDR *xdrs; - amq_mount_tree_p *objp; +xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp) { if (!xdr_pointer(xdrs, (char **)objp, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { return (FALSE); @@ -396,9 +369,7 @@ xdr_amq_mount_tree_p(xdrs, objp) bool_t -xdr_amq_mount_stats(xdrs, objp) - XDR *xdrs; - amq_mount_stats *objp; +xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp) { if (!xdr_int(xdrs, &objp->as_drops)) { return (FALSE); @@ -420,9 +391,7 @@ xdr_amq_mount_stats(xdrs, objp) bool_t -xdr_amq_mount_tree_list(xdrs, objp) - XDR *xdrs; - amq_mount_tree_list *objp; +xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp) { if (!xdr_array(xdrs, (char **)&objp->amq_mount_tree_list_val, (u_int *)&objp->amq_mount_tree_list_len, ~0, sizeof(amq_mount_tree_p), xdr_amq_mount_tree_p)) { return (FALSE); @@ -431,15 +400,14 @@ xdr_amq_mount_tree_list(xdrs, objp) } bool_t -xdr_amq_mount_info_qelem(xdrs, qhead) - XDR *xdrs; - qelem *qhead; +xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead) { /* * Compute length of list */ mntfs *mf; u_int len = 0; + for (mf = LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) { if (!(mf->mf_ops->fs_flags & FS_AMQINFO)) continue; diff --git a/usr.sbin/amd/amd/clock.c b/usr.sbin/amd/amd/clock.c index 4c5c25f9859..e8c5ee76180 100644 --- a/usr.sbin/amd/amd/clock.c +++ b/usr.sbin/amd/amd/clock.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 8.1 (Berkeley) 6/6/93 - * $Id: clock.c,v 1.2 2001/03/02 06:22:02 deraadt Exp $ + * $Id: clock.c,v 1.3 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -78,8 +78,8 @@ time_t next_softclock; /* Time of next call to softclock() */ #define CID_ALLOC() (++callout_id) #define CID_UNDEF (0) -static callout *alloc_callout(P_void); -static callout *alloc_callout() +static callout * +alloc_callout(P_void) { callout *cp = free_callouts; if (cp) { @@ -90,9 +90,8 @@ static callout *alloc_callout() return ALLOC(callout); } -static void free_callout P((callout *cp)); -static void free_callout(cp) -callout *cp; +static void +free_callout(callout *cp) { if (nfree_callouts > CALLOUT_FREE_SLOP) { free((voidp) cp); @@ -108,11 +107,8 @@ callout *cp; * * (*fn)(closure) will be called at clocktime() + secs */ -int timeout P((unsigned int secs, void (*fn)(), voidp closure)); -int timeout(secs, fn, closure) -unsigned int secs; -void (*fn)(); -voidp closure; +int +timeout(unsigned int secs, void (*fn)(), voidp closure) { callout *cp, *cp2; time_t t = clocktime() + secs; @@ -151,9 +147,8 @@ voidp closure; /* * De-schedule a callout */ -void untimeout P((int id)); -void untimeout(id) -int id; +void +untimeout(int id) { callout *cp, *cp2; for (cp = &callouts; (cp2 = cp->c_next); cp = cp2) { @@ -168,10 +163,8 @@ int id; /* * Reschedule after clock changed */ -void reschedule_timeouts P((time_t now, time_t then)); -void reschedule_timeouts(now, then) -time_t now; -time_t then; +void +reschedule_timeouts(time_t now, time_t then) { callout *cp; @@ -190,8 +183,8 @@ time_t then; /* * Clock handler */ -int softclock(P_void); -int softclock() +int +softclock(P_void) { time_t now; callout *cp; diff --git a/usr.sbin/amd/amd/efs_ops.c b/usr.sbin/amd/amd/efs_ops.c index 88e491ca8f0..82b8cde39fb 100644 --- a/usr.sbin/amd/amd/efs_ops.c +++ b/usr.sbin/amd/amd/efs_ops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)efs_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: efs_ops.c,v 1.1 1995/10/18 08:47:10 deraadt Exp $ + * $Id: efs_ops.c,v 1.2 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -54,22 +54,22 @@ /* * EFS file system always matches */ -static char *efs_match(fo) -am_opts *fo; +static char * +efs_match(am_opts *fo) { return strdup("(error-hook)"); } /*ARGSUSED*/ -static int efs_fmount(mf) -mntfs *mf; +static int +efs_fmount(mntfs *mf) { return ENOENT; } /*ARGSUSED*/ -static int efs_fumount(mf) -mntfs *mf; +static int +efs_fumount(mntfs *mf) { /* * Always succeed @@ -84,11 +84,8 @@ mntfs *mf; * If we do then just give an error. */ /*ARGSUSED*/ -am_node *efs_lookuppn(mp, fname, error_return, op) -am_node *mp; -char *fname; -int *error_return; -int op; +am_node * +efs_lookuppn(am_node *mp, char *fname, int *error_return, int op) { *error_return = ESTALE; return 0; @@ -100,12 +97,9 @@ int op; * If we do then just give an error. */ /*ARGSUSED*/ -int efs_readdir(mp, cookie, dp, ep, count) -am_node *mp; -nfscookie cookie; -dirlist *dp; -entry *ep; -int count; +int +efs_readdir(am_node *mp, nfscookie cookie, dirlist *dp, entry *ep, + int count) { return ESTALE; } diff --git a/usr.sbin/amd/amd/get_args.c b/usr.sbin/amd/amd/get_args.c index 0ddf9112693..19aa0346917 100644 --- a/usr.sbin/amd/amd/get_args.c +++ b/usr.sbin/amd/amd/get_args.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)get_args.c 8.1 (Berkeley) 6/6/93 - * $Id: get_args.c,v 1.5 2002/07/18 02:03:00 deraadt Exp $ + * $Id: get_args.c,v 1.6 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -51,7 +51,6 @@ extern int optind; extern char *optarg; -extern char *__progname; #if defined(DEBUG) && defined(PARANOID) char **gargv; @@ -96,16 +95,15 @@ int debug_flags = D_AMQ /* Register AMQ */ /* * Switch on/off debug options */ -int debug_option(opt) -char *opt; +int +debug_option(char *opt) { return cmdoption(opt, dbg_opt, &debug_flags); } #endif /* DEBUG */ -void get_args(c, v) -int c; -char *v[]; +void +get_args(int c, char *v[]) { int opt_ch; int usage = 0; @@ -113,119 +111,119 @@ char *v[]; char *sub_domain = 0; while ((opt_ch = getopt(c, v, "mnprva:c:d:h:k:l:t:w:x:y:C:D:")) != -1) - switch (opt_ch) { - case 'a': - if (*optarg != '/') { - fprintf(stderr, "%s: -a option must begin with a '/'\n", - __progname); - exit(1); - } - auto_dir = optarg; - break; - - case 'c': - am_timeo = atoi(optarg); - if (am_timeo <= 0) - am_timeo = AM_TTL; - break; - - case 'd': - sub_domain = optarg; - break; - - case 'h': + switch (opt_ch) { + case 'a': + if (*optarg != '/') { + fprintf(stderr, "%s: -a option must begin with a '/'\n", + __progname); + exit(1); + } + auto_dir = optarg; + break; + + case 'c': + am_timeo = atoi(optarg); + if (am_timeo <= 0) + am_timeo = AM_TTL; + break; + + case 'd': + sub_domain = optarg; + break; + + case 'h': #if defined(HAS_HOST) && defined(HOST_EXEC) - host_helper = optarg; + host_helper = optarg; #else - plog(XLOG_USER, "-h: option ignored. HOST_EXEC is not enabled."); - break; + plog(XLOG_USER, "-h: option ignored. HOST_EXEC is not enabled."); + break; #endif /* defined(HAS_HOST) && defined(HOST_EXEC) */ - case 'k': - karch = optarg; - break; - - case 'l': - logfile = optarg; - break; - - case 'm': - plog(XLOG_USER, "The -m option is no longer supported."); - plog(XLOG_USER, "... Use `ypcat -k am.master` on the command line instead"); - break; - - case 'n': - normalize_hosts = 1; - break; - - case 'p': - print_pid = 1; - break; - - case 'r': - restart_existing_mounts = 1; - break; - - case 't': - /* timeo.retrans */ - { char *dot = strchr(optarg, '.'); - if (dot) *dot = '\0'; - if (*optarg) { - afs_timeo = atoi(optarg); - } - if (dot) { - afs_retrans = atoi(dot+1); - *dot = '.'; - } - } - break; - - case 'v': - fprintf(stderr, "%s%s (%s-endian).\n", copyright, version, endian); - fputs("Map support for: ", stderr); - mapc_showtypes(stderr); - fputs(".\nFS: ", stderr); - ops_showfstypes(stderr); - fputs(".\n", stderr); - fprintf(stderr, "Primary network is %s.\n", wire); - exit(0); - break; - - case 'w': - am_timeo_w = atoi(optarg); - if (am_timeo_w <= 0) - am_timeo_w = AM_TTL_W; - break; - - case 'x': - usage += switch_option(optarg); - break; - - case 'y': + case 'k': + karch = optarg; + break; + + case 'l': + logfile = optarg; + break; + + case 'm': + plog(XLOG_USER, "The -m option is no longer supported."); + plog(XLOG_USER, "... Use `ypcat -k am.master` on the command line instead"); + break; + + case 'n': + normalize_hosts = 1; + break; + + case 'p': + print_pid = 1; + break; + + case 'r': + restart_existing_mounts = 1; + break; + + case 't': + /* timeo.retrans */ + { char *dot = strchr(optarg, '.'); + if (dot) *dot = '\0'; + if (*optarg) { + afs_timeo = atoi(optarg); + } + if (dot) { + afs_retrans = atoi(dot+1); + *dot = '.'; + } + } + break; + + case 'v': + fprintf(stderr, "%s%s (%s-endian).\n", copyright, version, endian); + fputs("Map support for: ", stderr); + mapc_showtypes(stderr); + fputs(".\nFS: ", stderr); + ops_showfstypes(stderr); + fputs(".\n", stderr); + fprintf(stderr, "Primary network is %s.\n", wire); + exit(0); + break; + + case 'w': + am_timeo_w = atoi(optarg); + if (am_timeo_w <= 0) + am_timeo_w = AM_TTL_W; + break; + + case 'x': + usage += switch_option(optarg); + break; + + case 'y': #ifdef HAS_NIS_MAPS - domain = optarg; + domain = optarg; #else - plog(XLOG_USER, "-y: option ignored. No NIS support available."); + plog(XLOG_USER, "-y: option ignored. No NIS support available."); #endif /* HAS_NIS_MAPS */ - break; + break; - case 'C': - cluster = optarg; - break; + case 'C': + cluster = optarg; + break; - case 'D': + case 'D': #ifdef DEBUG - usage += debug_option(optarg); + usage += debug_option(optarg); #else - fprintf(stderr, "%s: not compiled with DEBUG option -- sorry.\n", - __progname); + fprintf(stderr, "%s: not compiled with DEBUG option -- sorry.\n", + __progname); #endif /* DEBUG */ - break; + break; - default: - usage = 1; - break; - } + default: + usage = 1; + break; + } if (xlog_level_init == ~0) { (void) switch_option(""); diff --git a/usr.sbin/amd/amd/host_ops.c b/usr.sbin/amd/amd/host_ops.c index cc752d52c83..e9dae9e8014 100644 --- a/usr.sbin/amd/amd/host_ops.c +++ b/usr.sbin/amd/amd/host_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: host_ops.c,v 1.7 2002/07/18 02:03:00 deraadt Exp $ */ +/* $OpenBSD: host_ops.c,v 1.8 2002/08/03 08:29:31 pvalchev Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -80,9 +80,8 @@ /* * Execute needs the same as NFS plus a helper command */ -static char *host_match P((am_opts *fo)); -static char *host_match(fo) -am_opts *fo; +static char * +host_match(am_opts *fo) { #ifdef HOST_EXEC if (!host_helper) { @@ -100,8 +99,8 @@ am_opts *fo; return (*nfs_ops.fs_match)(fo); } -static int host_init(mf) -mntfs *mf; +static int +host_init(mntfs *mf) { if (strchr(mf->mf_info, ':') == 0) return ENOENT; @@ -121,24 +120,19 @@ mntfs *mf; #ifndef HOST_EXEC static bool_t -xdr_pri_free(xdr_args, args_ptr) -xdrproc_t xdr_args; -caddr_t args_ptr; +xdr_pri_free(xdrproc_t xdr_args, caddr_t args_ptr) { XDR xdr; + xdr.x_op = XDR_FREE; return ((*xdr_args)(&xdr, args_ptr)); } -static int do_mount P((fhstatus *fhp, char *dir, char *fs_name, char *opts, mntfs *mf)); -static int do_mount(fhp, dir, fs_name, opts, mf) -fhstatus *fhp; -char *dir; -char *fs_name; -char *opts; -mntfs *mf; +static int +do_mount(fhstatus *fhp, char *dir, char *fs_name, char *opts, mntfs *mf) { struct stat stb; + #ifdef DEBUG dlog("host: mounting fs %s on %s\n", fs_name, dir); #endif /* DEBUG */ @@ -153,9 +147,8 @@ mntfs *mf; return mount_nfs_fh(fhp, dir, fs_name, opts, mf); } -static int sortfun P((const void *arg1, const void *arg2)); -static int sortfun(arg1, arg2) -const void *arg1, *arg2; +static int +sortfun(const void *arg1, const void *arg2) { const exports *a = arg1, *b = arg2; return strcmp((*a)->ex_dir, (*b)->ex_dir); @@ -164,11 +157,8 @@ const void *arg1, *arg2; /* * Get filehandle */ -static int fetch_fhandle P((CLIENT *client, char *dir, fhstatus *fhp)); -static int fetch_fhandle(client, dir, fhp) -CLIENT *client; -char *dir; -fhstatus *fhp; +static int +fetch_fhandle(CLIENT *client, char *dir, fhstatus *fhp) { struct timeval tv; enum clnt_stat clnt_stat; @@ -212,10 +202,8 @@ fhstatus *fhp; /* * Scan mount table to see if something already mounted */ -static int already_mounted P((mntlist *mlist, char*dir)); -static int already_mounted(mlist, dir) -mntlist *mlist; -char *dir; +static int +already_mounted(mntlist *mlist, char*dir) { mntlist *ml; @@ -228,9 +216,8 @@ char *dir; /* * Mount the export tree from a host */ -static int host_fmount P((mntfs *mf)); -static int host_fmount(mf) -mntfs *mf; +static int +host_fmount(mntfs *mf) { struct timeval tv2; CLIENT *client; @@ -407,10 +394,8 @@ out: * TODO: * Does not work if pref is "/". */ -static int directory_prefix P((char *pref, char *dir)); -static int directory_prefix(pref, dir) -char *pref; -char *dir; +static int +directory_prefix(char *pref, char *dir) { int len = strlen(pref); if (strncmp(pref, dir, len) != 0) @@ -423,9 +408,8 @@ char *dir; /* * Unmount a mount tree */ -static int host_fumount P((mntfs *mf)); -static int host_fumount(mf) -mntfs *mf; +static int +host_fumount(mntfs *mf) { mntlist *ml, *mprev; int xerror = 0; @@ -475,7 +459,7 @@ mntfs *mf; xerror = error; if (error != EBUSY) { errno = error; - plog("Tree unmount of %s failed: %m", ml->mnt->mnt_dir); + plog(XLOG_ERROR, "Tree unmount of %s failed: %m", ml->mnt->mnt_dir); } } else { #ifdef HOST_MKDIRS @@ -512,8 +496,7 @@ mntfs *mf; * have other filesystems mounted, but the existing * mountd protocol is badly broken anyway. */ -static void host_umounted(mp) -am_node *mp; +static void host_umounted(am_node *mp) { #ifdef INFORM_MOUNTD mntfs *mf = mp->am_mnt; @@ -575,12 +558,8 @@ out: #else /* HOST_EXEC */ -static int host_exec P((char*op, char*host, char*fs, char*opts)); -static int host_exec(op, host, fs, opts) -char *op; -char *host; -char *fs; -char *opts; +static int +host_exec(char *op, char *host, char *fs, char *opts) { int error; char *argv[7]; @@ -636,18 +615,16 @@ char *opts; return error; } -static int host_mount P((am_node *mp)); -static int host_mount(mp) -am_node *mp; +static int +host_mount(am_node *mp) { mntfs *mf = mp->am_mnt; return host_exec("mount", mf->mf_server->fs_host, mf->mf_mount, mf->mf_opts); } -static int host_umount P((am_node *mp)); -static int host_umount(mp) -am_node *mp; +static int +host_umount(am_node *mp) { mntfs *mf = mp->am_mnt; diff --git a/usr.sbin/amd/amd/ifs_ops.c b/usr.sbin/amd/amd/ifs_ops.c index cf9d172f458..4d8495d11d7 100644 --- a/usr.sbin/amd/amd/ifs_ops.c +++ b/usr.sbin/amd/amd/ifs_ops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)ifs_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: ifs_ops.c,v 1.1 1995/10/18 08:47:10 deraadt Exp $ + * $Id: ifs_ops.c,v 1.2 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -56,17 +56,15 @@ static char not_a_filesystem[] = "Attempting to inherit not-a-filesystem"; * This should never be called. */ /*ARGSUSED*/ -static char *ifs_match P((am_opts *fo)); -static char *ifs_match(fo) -am_opts *fo; +static char * +ifs_match(am_opts *fo) { plog(XLOG_FATAL, "ifs_match called!"); return 0; } -static int ifs_init P((mntfs *mf)); -static int ifs_init(mf) -mntfs *mf; +static int +ifs_init(mntfs *mf) { mntfs *mf_link = (mntfs *) mf->mf_private; if (mf_link == 0) { @@ -87,9 +85,8 @@ mntfs *mf; return 0; } -static mntfs *ifs_inherit P((mntfs *mf)); -static mntfs *ifs_inherit(mf) -mntfs *mf; +static mntfs * +ifs_inherit(mntfs *mf) { /* * Take the linked mount point and @@ -130,9 +127,8 @@ mntfs *mf; return mf_link; } -static int ifs_mount P((am_node *mp)); -static int ifs_mount(mp) -am_node *mp; +static int +ifs_mount(am_node *mp) { mntfs *newmf = ifs_inherit(mp->am_mnt); if (newmf) { @@ -149,9 +145,8 @@ am_node *mp; return EINVAL; } -static int ifs_fmount P((mntfs *mf)); -static int ifs_fmount(mf) -mntfs *mf; +static int +ifs_fmount(mntfs *mf) { am_node *mp = find_mf(mf); if (mp) @@ -160,9 +155,8 @@ mntfs *mf; } /*ARGSUSED*/ -static int ifs_fumount P((mntfs *mf)); -static int ifs_fumount(mf) -mntfs *mf; +static int +ifs_fumount(mntfs *mf) { /* * Always succeed diff --git a/usr.sbin/amd/amd/info_hes.c b/usr.sbin/amd/amd/info_hes.c index 86e4b93ab12..33fd6035389 100644 --- a/usr.sbin/amd/amd/info_hes.c +++ b/usr.sbin/amd/amd/info_hes.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)info_hes.c 8.1 (Berkeley) 6/6/93 - * $Id: info_hes.c,v 1.10 2002/07/18 02:14:45 deraadt Exp $ + * $Id: info_hes.c,v 1.11 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -338,7 +338,7 @@ hs_res_send(char *buf, int buflen, char *answer, int anslen) int hs_readresp(int s, char *answer, int anslen) { - register int len, n; + int len, n; char *cp; cp = answer; @@ -370,7 +370,7 @@ hs_readresp(int s, char *answer, int anslen) int hs_res_vcread(int sock, char *buf, int buflen, struct timeval *timeout) { - register int n; + int n; if ((n = hs_res_selwait(sock, timeout)) > 0) return(read(sock, buf, buflen)); @@ -383,7 +383,7 @@ hs_res_selwait(int sock, struct timeval timeout) { fd_set *fdsp; int fdsn; - register int n; + int n; /* * Wait for reply @@ -407,9 +407,9 @@ hs_res_selwait(int sock, struct timeval timeout) int hs_parse(char *msg, char *eom) { - register char *cp; - register HEADER *hp; - register int n, len; + char *cp; + HEADER *hp; + int n, len; int qdcount, ancount; char key[PACKETSZ]; char *key_cpy, *value, *hs_make_value(); @@ -576,12 +576,12 @@ add_address(struct in_addr *addr) int hs_get_ns_list(char *domain) { - register HEADER *hp; + HEADER *hp; int qdcount, nscount; - register char *cp; - register int n, len; + char *cp; + int n, len; char key[PACKETSZ], name[PACKETSZ], msg[PACKETSZ], *eom; - register u_int32_t **hptr; + u_int32_t **hptr; struct hostent *ghp; int numns; char nsname[MAXHSNS][MAXDATA]; diff --git a/usr.sbin/amd/amd/info_nis.c b/usr.sbin/amd/amd/info_nis.c index e058302a1cb..70e62258b08 100644 --- a/usr.sbin/amd/amd/info_nis.c +++ b/usr.sbin/amd/amd/info_nis.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)info_nis.c 8.1 (Berkeley) 6/6/93 - * $Id: info_nis.c,v 1.7 2002/07/18 02:14:45 deraadt Exp $ + * $Id: info_nis.c,v 1.8 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -153,8 +153,8 @@ nis_reload(mnt_map *m, char *map, void (*fn)()) data.ncd_m = m; data.ncd_map = map; data.ncd_fn = fn; - cbinfo.data = (voidp) &data; - cbinfo.foreach = callback; + cbinfo.data = (voidp)&data; + cbinfo.foreach = (voidp)&callback; error = yp_all(domain, map, &cbinfo); diff --git a/usr.sbin/amd/amd/map.c b/usr.sbin/amd/amd/map.c index a874611de76..07d13796b09 100644 --- a/usr.sbin/amd/amd/map.c +++ b/usr.sbin/amd/amd/map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map.c,v 1.5 2002/07/18 02:03:00 deraadt Exp $ */ +/* $OpenBSD: map.c,v 1.6 2002/08/03 08:29:31 pvalchev Exp $ */ /*- * Copyright (c) 1990 Jan-Simon Pendry @@ -40,7 +40,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)map.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$OpenBSD: map.c,v 1.5 2002/07/18 02:03:00 deraadt Exp $"; +static char *rcsid = "$OpenBSD: map.c,v 1.6 2002/08/03 08:29:31 pvalchev Exp $"; #endif /* not lint */ #include "am.h" @@ -96,9 +96,8 @@ static struct fattr gen_fattr = { /* * Resize exported_ap map */ -static int exported_ap_realloc_map P((int nsize)); -static int exported_ap_realloc_map(nsize) -int nsize; +static int +exported_ap_realloc_map(int nsize) { #ifdef notdef /* @@ -182,9 +181,8 @@ am_node *exported_ap_alloc(P_void) /* * Free a mount slot */ -void exported_ap_free P((am_node *mp)); -void exported_ap_free(mp) -am_node *mp; +void +exported_ap_free(am_node *mp) { /* * Sanity check @@ -225,9 +223,8 @@ am_node *mp; * of any other children, and the parent's child * pointer is adjusted to point to the new child node. */ -void insert_am(mp, p_mp) -am_node *mp; -am_node *p_mp; +void +insert_am(am_node *mp, am_node *p_mp) { /* * If this is going in at the root then flag it @@ -248,8 +245,8 @@ am_node *p_mp; /* * Remove am from its place in the mount tree */ -void remove_am(mp) -am_node *mp; +void +remove_am(am_node *mp) { /* * 1. Consistency check @@ -276,8 +273,8 @@ am_node *mp; /* * Compute a new time to live value for a node. */ -void new_ttl(mp) -am_node *mp; +void +new_ttl(am_node *mp) { mp->am_timeo_w = 0; @@ -286,10 +283,8 @@ am_node *mp; mp->am_ttl += mp->am_timeo; /* sun's -tl option */ } -void mk_fattr P((am_node *mp, int vntype)); -void mk_fattr(mp, vntype) -am_node *mp; -int vntype; +void +mk_fattr(am_node *mp, int vntype) { switch (vntype) { case NFDIR: @@ -316,9 +311,8 @@ int vntype; * before getting here so anything that would * be set to zero isn't done here. */ -void init_map(mp, dir) -am_node *mp; -char *dir; +void +init_map(am_node *mp, char *dir) { /* mp->am_mapno initalised by exported_ap_alloc */ mp->am_mnt = new_mntfs(); @@ -352,8 +346,8 @@ char *dir; * Free a mount node. * The node must be already unmounted. */ -void free_map(mp) -am_node *mp; +void +free_map(am_node *mp) { remove_am(mp); @@ -376,10 +370,8 @@ am_node *mp; * Convert from file handle to * automount node. */ -am_node *fh_to_mp3(fhp, rp, c_or_d) -nfs_fh *fhp; -int *rp; -int c_or_d; +am_node * +fh_to_mp3(nfs_fh *fhp, int *rp, int c_or_d) { struct am_fh *fp = (struct am_fh *) fhp; am_node *ap = 0; @@ -504,8 +496,8 @@ drop: return ap; } -am_node *fh_to_mp(fhp) -nfs_fh *fhp; +am_node * +fh_to_mp(nfs_fh *fhp) { int dummy; return fh_to_mp2(fhp, &dummy); @@ -515,9 +507,8 @@ nfs_fh *fhp; * Convert from automount node to * file handle. */ -void mp_to_fh(mp, fhp) -am_node *mp; -struct nfs_fh *fhp; +void +mp_to_fh(am_node *mp, struct nfs_fh *fhp) { struct am_fh *fp = (struct am_fh *) fhp; @@ -541,10 +532,8 @@ struct nfs_fh *fhp; */ } -static am_node *find_ap2 P((char *dir, am_node *mp)); -static am_node *find_ap2(dir, mp) -char *dir; -am_node *mp; +static am_node * +find_ap2(char *dir, am_node *mp) { if (mp) { am_node *mp2; @@ -570,9 +559,8 @@ am_node *mp; * automount path or, if the node is * mounted, the mount location. */ -am_node *find_ap P((char *dir)); -am_node *find_ap(dir) -char *dir; +am_node * +find_ap(char *dir) { int i; @@ -592,9 +580,8 @@ char *dir; * Find the mount node corresponding * to the mntfs structure. */ -am_node *find_mf P((mntfs *mf)); -am_node *find_mf(mf) -mntfs *mf; +am_node * +find_mf(mntfs *mf) { int i; @@ -611,8 +598,8 @@ mntfs *mf; * This is used during the bootstrap to tell the kernel * the filehandles of the initial automount points. */ -nfs_fh *root_fh(dir) -char *dir; +nfs_fh * +root_fh(char *dir) { static nfs_fh nfh; am_node *mp = root_ap(dir, TRUE); @@ -638,9 +625,8 @@ char *dir; return 0; } -am_node *root_ap(dir, path) -char *dir; -int path; +am_node * +root_ap(char *dir, int path) { am_node *mp = find_ap(dir); if (mp && mp->am_parent == root_node) @@ -653,9 +639,8 @@ int path; * Timeout all nodes waiting on * a given Fserver. */ -void map_flush_srvr P((fserver *fs)); -void map_flush_srvr(fs) -fserver *fs; +void +map_flush_srvr(fserver *fs) { int i; int done = 0; @@ -678,12 +663,11 @@ fserver *fs; * (root) node which will cause the * automount node to be automounted. */ -int mount_auto_node P((char *dir, voidp arg)); -int mount_auto_node(dir, arg) -char *dir; -voidp arg; +int +mount_auto_node(char *dir, voidp arg) { int error = 0; + (void) afs_ops.lookuppn((am_node *) arg, dir, &error, VLOOK_CREATE); if (error > 0) { errno = error; /* XXX */ @@ -696,20 +680,20 @@ voidp arg; * Cause all the top-level mount nodes * to be automounted */ -int mount_exported P((void)); -int mount_exported() +int +mount_exported(void) { /* * Iterate over all the nodes to be started */ - return root_keyiter((void (*)P((char*,void*))) mount_auto_node, root_node); + return root_keyiter((void (*)(char *, void *)) mount_auto_node, root_node); } /* * Construct top-level node */ -void make_root_node P((void)); -void make_root_node() +void +make_root_node(void) { mntfs *root_mnt; char *rootmap = ROOT_MAP; @@ -745,9 +729,11 @@ void make_root_node() * Cause all the nodes to be unmounted by timing * them out. */ -void umount_exported(P_void) +void +umount_exported(P_void) { int i; + for (i = last_used_map; i >= 0; --i) { am_node *mp = exported_ap[i]; if (mp) { @@ -799,9 +785,8 @@ void umount_exported(P_void) } } -static int unmount_node P((am_node *mp)); -static int unmount_node(mp) -am_node *mp; +static int +unmount_node(am_node *mp) { mntfs *mf = mp->am_mnt; int error; @@ -833,13 +818,13 @@ am_node *mp; } #ifdef FLUSH_KERNEL_NAME_CACHE -static void flush_kernel_name_cache P((am_node*)); -static void flush_kernel_name_cache(mp) -am_node *mp; +static void +flush_kernel_name_cache(am_node *mp) { int islink = (mp->am_mnt->mf_fattr.type == NFLNK); int isdir = (mp->am_mnt->mf_fattr.type == NFDIR); int elog = 0; + if (islink) { if (unlink(mp->am_path) < 0) elog = 1; @@ -852,9 +837,8 @@ am_node *mp; } #endif /* FLUSH_KERNEL_NAME_CACHE */ -static int unmount_node_wrap P((voidp vp)); -static int unmount_node_wrap(vp) -voidp vp; +static int +unmount_node_wrap(voidp vp) { #ifndef FLUSH_KERNEL_NAME_CACHE return unmount_node((am_node*) vp); @@ -903,10 +887,8 @@ voidp vp; #endif /* FLUSH_KERNEL_NAME_CACHE */ } -static void free_map_if_success(rc, term, closure) -int rc; -int term; -voidp closure; +static void +free_map_if_success(int rc, int term, voidp closure) { am_node *mp = (am_node *) closure; mntfs *mf = mp->am_mnt; @@ -955,8 +937,8 @@ voidp closure; wakeup((voidp) mf); } -static int unmount_mp(mp) -am_node *mp; +static int +unmount_mp(am_node *mp) { int was_backgrounded = 0; mntfs *mf = mp->am_mnt; diff --git a/usr.sbin/amd/amd/mapc.c b/usr.sbin/amd/amd/mapc.c index c11cec0ed50..6f3f737a118 100644 --- a/usr.sbin/amd/amd/mapc.c +++ b/usr.sbin/amd/amd/mapc.c @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)mapc.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: mapc.c,v 1.5 2002/07/18 02:03:00 deraadt Exp $"; +static char *rcsid = "$Id: mapc.c,v 1.6 2002/08/03 08:29:31 pvalchev Exp $"; #endif /* not lint */ /* @@ -104,13 +104,13 @@ static struct opt_tab mapc_opt[] = { /* * Cache map operations */ -typedef void add_fn P((mnt_map*, char*, char*)); -typedef int init_fn P((char*, time_t*)); -typedef int search_fn P((mnt_map*, char*, char*, char**, time_t*)); -typedef int reload_fn P((mnt_map*, char*, add_fn*)); -typedef int mtime_fn P((char*, time_t*)); +typedef void add_fn(mnt_map *, char *, char *); +typedef int init_fn(char *, time_t *); +typedef int search_fn(mnt_map *, char *, char *, char **, time_t *); +typedef int reload_fn(mnt_map *, char *, add_fn *); +typedef int mtime_fn(char *, time_t *); -static void mapc_sync P((mnt_map*)); +static void mapc_sync(mnt_map *); /* * Map type @@ -165,66 +165,66 @@ qelem map_list_head = { &map_list_head, &map_list_head }; */ /* ROOT MAP */ -static int root_init P((char*, time_t*)); +static int root_init(char *, time_t *); /* FILE MAPS */ #ifdef HAS_FILE_MAPS -extern int file_init P((char*, time_t*)); -extern int file_reload P((mnt_map*, char*, add_fn*)); -extern int file_search P((mnt_map*, char*, char*, char**, time_t*)); -extern int file_mtime P((char*, time_t*)); +extern int file_init(char *, time_t *); +extern int file_reload(mnt_map *, char *, add_fn *); +extern int file_search(mnt_map *, char *, char *, char **, time_t *); +extern int file_mtime(char *, time_t *); #endif /* HAS_FILE_MAPS */ /* Network Information Service (NIS) MAPS */ #ifdef HAS_NIS_MAPS -extern int nis_init P((char*, time_t*)); +extern int nis_init(char *, time_t *); #ifdef HAS_NIS_RELOAD -extern int nis_reload P((mnt_map*, char*, add_fn*)); +extern int nis_reload(mnt_map *, char *, add_fn *); #else #define nis_reload error_reload #endif -extern int nis_search P((mnt_map*, char*, char*, char**, time_t*)); +extern int nis_search(mnt_map *, char *, char *, char **, time_t *); #define nis_mtime nis_init #endif /* HAS_NIS_MAPS */ /* NDBM MAPS */ #ifdef HAS_NDBM_MAPS #ifdef OS_HAS_NDBM -extern int ndbm_init P((char*, time_t*)); -extern int ndbm_search P((mnt_map*, char*, char*, char**, time_t*)); +extern int ndbm_init(char *, time_t *); +extern int ndbm_search(mnt_map *, char *, charo *, char **, time_t *); #define ndbm_mtime ndbm_init #endif /* OS_HAS_NDBM */ #endif /* HAS_NDBM_MAPS */ /* PASSWD MAPS */ #ifdef HAS_PASSWD_MAPS -extern int passwd_init P((char*, time_t*)); -extern int passwd_search P((mnt_map*, char*, char*, char**, time_t*)); +extern int passwd_init(char *, time_t *); +extern int passwd_search(mnt_map *, char *, char *, char **, time_t *); #endif /* HAS_PASSWD_MAPS */ /* HESIOD MAPS */ #ifdef HAS_HESIOD_MAPS -extern int hesiod_init P((char*, time_t*)); +extern int hesiod_init(char *, time_t *); #ifdef HAS_HESIOD_RELOAD -extern int hesiod_reload P((mnt_map*, char*, add_fn*)); +extern int hesiod_reload(mnt_map *, char *, add_fn *); #else #define hesiod_reload error_reload #endif -extern int hesiod_search P((mnt_map*, char*, char*, char**, time_t*)); +extern int hesiod_search(mnt_map *, char *, char *, char **, time_t *); #endif /* HAS_HESIOD_MAPS */ /* UNION MAPS */ #ifdef HAS_UNION_MAPS -extern int union_init P((char*, time_t*)); -extern int union_search P((mnt_map*, char*, char*, char**, time_t*)); -extern int union_reload P((mnt_map*, char*, add_fn*)); +extern int union_init(char *, time_t *); +extern int union_search(mnt_map *, char *, char *, char **, time_t *); +extern int union_reload(mnt_map *, char *, add_fn *); #endif /* HAS_UNION_MAPS */ /* ERROR MAP */ -static int error_init P((char*, time_t*)); -static int error_reload P((mnt_map*, char*, add_fn*)); -static int error_search P((mnt_map*, char*, char*, char**, time_t*)); -static int error_mtime P((char*, time_t*)); +static int error_init(char *, time_t *); +static int error_reload(mnt_map *, char *, add_fn *); +static int error_search(mnt_map *, char *, char *, char **, time_t *); +static int error_mtime(char *, time_t *); static map_type maptypes[] = { { "root", root_init, error_reload, error_search, error_mtime, MAPC_ROOT }, @@ -259,9 +259,8 @@ static map_type maptypes[] = { /* * Hash function */ -static unsigned int kvhash_of P((char *key)); -static unsigned int kvhash_of(key) -char *key; +static unsigned int +kvhash_of(char *key) { unsigned int i, j; @@ -271,12 +270,12 @@ char *key; return i % NKVHASH; } -void mapc_showtypes P((FILE *fp)); -void mapc_showtypes(fp) -FILE *fp; +void +mapc_showtypes(FILE *fp) { map_type *mt; char *sep = ""; + for (mt = maptypes; mt < maptypes+sizeof(maptypes)/sizeof(maptypes[0]); mt++) { fprintf(fp, "%s%s", sep, mt->name); sep = ", "; @@ -284,9 +283,8 @@ FILE *fp; } static Const char *reg_error = "?"; -void regerror P((Const char *m)); -void regerror(m) -Const char *m; +void +regerror(Const char *m) { reg_error = m; } @@ -295,11 +293,8 @@ Const char *m; * Add key and val to the map m. * key and val are assumed to be safe copies */ -void mapc_add_kv P((mnt_map *m, char *key, char *val)); -void mapc_add_kv(m, key, val) -mnt_map *m; -char *key; -char *val; +void +mapc_add_kv(mnt_map *m, char *key, char *val) { kv **h; kv *n; @@ -336,11 +331,8 @@ char *val; *h = n; } -void mapc_repl_kv P((mnt_map *m, char *key, char *val)); -void mapc_repl_kv(m, key, val) -mnt_map *m; -char *key; -char *val; +void +mapc_repl_kv(mnt_map *m, char *key, char *val) { kv *k; @@ -369,13 +361,10 @@ char *val; * Calls map specific search routine. * While map is out of date, keep re-syncing. */ -static int search_map P((mnt_map *m, char *key, char **valp)); -static int search_map(m, key, valp) -mnt_map *m; -char *key; -char **valp; +static int search_map(mnt_map *m, char *key, char **valp) { int rc; + do { rc = (*m->search)(m, m->map_name, key, valp, &m->modify); if (rc < 0) { @@ -391,9 +380,8 @@ char **valp; * Do a wildcard lookup in the map and * save the result. */ -static void mapc_find_wildcard P((mnt_map *m)); -static void mapc_find_wildcard(m) -mnt_map *m; +static void +mapc_find_wildcard(mnt_map *m) { /* * Attempt to find the wildcard entry @@ -412,8 +400,8 @@ mnt_map *m; /* * Do a map reload */ -static int mapc_reload_map(m) -mnt_map *m; +static int +mapc_reload_map(mnt_map *m) { int error; #ifdef DEBUG @@ -435,10 +423,8 @@ mnt_map *m; /* * Create a new map */ -static mnt_map *mapc_create P((char *map, char *opt)); -static mnt_map *mapc_create(map, opt) -char *map; -char *opt; +static mnt_map * +mapc_create(char *map, char *opt) { mnt_map *m = ALLOC(mnt_map); map_type *mt; @@ -512,9 +498,8 @@ char *opt; /* * Free the cached data in a map */ -static void mapc_clear P((mnt_map *m)); -static void mapc_clear(m) -mnt_map *m; +static void +mapc_clear(mnt_map *m) { int i; @@ -549,10 +534,8 @@ mnt_map *m; /* * Find a map, or create one if it does not exist */ -mnt_map *mapc_find P((char *map, char *opt)); -mnt_map *mapc_find(map, opt) -char *map; -char *opt; +mnt_map * +mapc_find(char *map, char *opt) { mnt_map *m; @@ -575,9 +558,8 @@ char *opt; /* * Free a map. */ -void mapc_free P((mnt_map *m)); -void mapc_free(m) -mnt_map *m; +void +mapc_free(mnt_map *m) { /* * Decrement the reference count. @@ -597,12 +579,8 @@ mnt_map *m; * Put a safe copy in *pval or return * an error code */ -int mapc_meta_search P((mnt_map *m, char *key, char **pval, int recurse)); -int mapc_meta_search(m, key, pval, recurse) -mnt_map *m; -char *key; -char **pval; -int recurse; +int +mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse) { int error = 0; kv *k = 0; @@ -725,11 +703,8 @@ int recurse; return error; } -int mapc_search P((mnt_map *m, char *key, char **pval)); -int mapc_search(m, key, pval) -mnt_map *m; -char *key; -char **pval; +int +mapc_search(mnt_map *m, char *key, char **pval) { return mapc_meta_search(m, key, pval, MREC_FULL); } @@ -737,9 +712,8 @@ char **pval; /* * Get map cache in sync with physical representation */ -static void mapc_sync P((mnt_map *m)); -static void mapc_sync(m) -mnt_map *m; +static void +mapc_sync(mnt_map *m) { if (m->alloc != MAPC_ROOT) { mapc_clear(m); @@ -759,8 +733,7 @@ mnt_map *m; * Reload all the maps * Called when Amd gets hit by a SIGHUP. */ -void mapc_reload(P_void); -void mapc_reload() +void mapc_reload(P_void) { mnt_map *m; @@ -783,10 +756,8 @@ void mapc_reload() * This causes the top level mounts to be automounted. */ -static int root_init P((char *map, time_t *tp)); -static int root_init(map, tp) -char *map; -time_t *tp; +static int +root_init(char *map, time_t *tp) { *tp = clocktime(); return strcmp(map, ROOT_MAP) == 0 ? 0 : ENOENT; @@ -799,11 +770,8 @@ time_t *tp; * opts - mount options * map - map name */ -void root_newmap P((char *dir, char *opts, char *map)); -void root_newmap(dir, opts, map) -char *dir; -char *opts; -char *map; +void +root_newmap(char *dir, char *opts, char *map) { char str[MAXPATHLEN]; @@ -825,11 +793,8 @@ char *map; mapc_repl_kv(root_map, dir, strdup(str)); } -int mapc_keyiter P((mnt_map *m, void (*fn)(char*,voidp), voidp arg)); -int mapc_keyiter(m, fn, arg) -mnt_map *m; -void (*fn)P((char*, voidp)); -voidp arg; +int +mapc_keyiter(mnt_map *m, void (*fn)(char*,voidp), voidp arg) { int i; int c = 0; @@ -852,10 +817,8 @@ voidp arg; * of all the nodes. * Finally throw away the root map. */ -int root_keyiter P((void (*fn)(char*,voidp), voidp arg)); -int root_keyiter(fn, arg) -void (*fn)P((char*,voidp)); -voidp arg; +int +root_keyiter(void (*fn)(char*,voidp), voidp arg) { if (root_map) { int c = mapc_keyiter(root_map, fn, arg); @@ -871,10 +834,8 @@ voidp arg; /* * Error map */ -static int error_init P((char *map, time_t *tp)); -static int error_init(map, tp) -char *map; -time_t *tp; +static int +error_init(char *map, time_t *tp) { plog(XLOG_USER, "No source data for map %s", map); *tp = 0; @@ -882,31 +843,21 @@ time_t *tp; } /*ARGSUSED*/ -static int error_search P((mnt_map *m, char *map, char *key, char **pval, time_t *tp)); -static int error_search(m, map, key, pval, tp) -mnt_map *m; -char *map; -char *key; -char **pval; -time_t *tp; +static int +error_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp) { return ENOENT; } /*ARGSUSED*/ -static int error_reload P((mnt_map *m, char *map, add_fn *fn)); -static int error_reload(m, map, fn) -mnt_map *m; -char *map; -add_fn *fn; +static int +error_reload(mnt_map *m, char *map, add_fn *fn) { return ENOENT; } -static int error_mtime P((char *map, time_t *tp)); -static int error_mtime(map, tp) -char *map; -time_t *tp; +static int +error_mtime(char *map, time_t *tp) { *tp = 0; return 0; diff --git a/usr.sbin/amd/amd/misc_rpc.c b/usr.sbin/amd/amd/misc_rpc.c index 720816846ae..27f02d429de 100644 --- a/usr.sbin/amd/amd/misc_rpc.c +++ b/usr.sbin/amd/amd/misc_rpc.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)misc_rpc.c 8.1 (Berkeley) 6/6/93 - * $Id: misc_rpc.c,v 1.4 2002/02/23 09:18:27 deraadt Exp $ + * $Id: misc_rpc.c,v 1.5 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -45,15 +45,14 @@ #include "am.h" -void rpc_msg_init P((struct rpc_msg *mp, u_long prog, u_long vers, u_long proc)); -int pickup_rpc_reply P((voidp pkt, int len, voidp where, xdrproc_t where_xdr)); -int make_rpc_packet P((char *buf, int buflen, unsigned long proc, - struct rpc_msg *mp, voidp arg, xdrproc_t arg_xdr, AUTH *auth)); +void rpc_msg_init(struct rpc_msg *, u_long, u_long, u_long); +int pickup_rpc_reply(voidp, int, voidp, xdrproc_t); +int make_rpc_packet(char *, int, unsigned long, struct rpc_msg *, + voidp, xdrproc_t, AUTH *); void -rpc_msg_init(mp, prog, vers, proc) -struct rpc_msg *mp; -unsigned long prog, vers, proc; +rpc_msg_init(struct rpc_msg *mp, unsigned long prog, + unsigned long vers, unsigned long proc) { /* * Initialise the message @@ -71,11 +70,7 @@ unsigned long prog, vers, proc; * Field reply to call to mountd */ int -pickup_rpc_reply(pkt, len, where, where_xdr) -voidp pkt; -int len; -voidp where; -xdrproc_t where_xdr; +pickup_rpc_reply(voidp pkt, int len, voidp where, xdrproc_t where_xdr) { XDR reply_xdr; int ok; @@ -115,14 +110,8 @@ drop: } int -make_rpc_packet(buf, buflen, proc, mp, arg, arg_xdr, auth) -char *buf; -int buflen; -unsigned long proc; -struct rpc_msg *mp; -voidp arg; -xdrproc_t arg_xdr; -AUTH *auth; +make_rpc_packet(char *buf, int buflen, unsigned long proc, + struct rpc_msg *mp, voidp arg, xdrproc_t arg_xdr, AUTH *auth) { XDR msg_xdr; int len; diff --git a/usr.sbin/amd/amd/mntfs.c b/usr.sbin/amd/amd/mntfs.c index 3c110ed39a9..fd05e4f7f43 100644 --- a/usr.sbin/amd/amd/mntfs.c +++ b/usr.sbin/amd/amd/mntfs.c @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)mntfs.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: mntfs.c,v 1.2 1997/06/24 07:48:40 deraadt Exp $"; +static char *rcsid = "$Id: mntfs.c,v 1.3 2002/08/03 08:29:31 pvalchev Exp $"; #endif /* not lint */ @@ -75,8 +75,8 @@ static struct fattr gen_fattr = { }; #endif /* notdef */ -mntfs *dup_mntfs(mf) -mntfs *mf; +mntfs * +dup_mntfs(mntfs *mf) { if (mf->mf_refc == 0) { if (mf->mf_cid) @@ -91,16 +91,9 @@ mntfs *mf; return mf; } -static void init_mntfs P((mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char *mopts, char *remopts)); -static void init_mntfs(mf, ops, mo, mp, info, auto_opts, mopts, remopts) -mntfs *mf; -am_ops *ops; -am_opts *mo; -char *mp; -char *info; -char *auto_opts; -char *mopts; -char *remopts; +static void +init_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, + char *auto_opts, char *mopts, char *remopts) { mf->mf_ops = ops; mf->mf_fo = mo; @@ -131,15 +124,9 @@ char *remopts; mf->mf_server = 0; } -static mntfs *alloc_mntfs P((am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char *mopts, char *remopts)); -static mntfs *alloc_mntfs(ops, mo, mp, info, auto_opts, mopts, remopts) -am_ops *ops; -am_opts *mo; -char *mp; -char *info; -char *auto_opts; -char *mopts; -char *remopts; +static mntfs * +alloc_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, + char *auto_opts, char *mopts, char *remopts) { mntfs *mf = ALLOC(mntfs); init_mntfs(mf, ops, mo, mp, info, auto_opts, mopts, remopts); @@ -149,15 +136,9 @@ char *remopts; return mf; } -mntfs *find_mntfs P((am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char *mopts, char *remopts)); -mntfs *find_mntfs(ops, mo, mp, info, auto_opts, mopts, remopts) -am_ops *ops; -am_opts *mo; -char *mp; -char *info; -char *auto_opts; -char *mopts; -char *remopts; +mntfs * +find_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, + char *auto_opts, char *mopts, char *remopts) { mntfs *mf; @@ -225,14 +206,14 @@ char *remopts; return alloc_mntfs(ops, mo, mp, info, auto_opts, mopts, remopts); } -mntfs *new_mntfs() +mntfs * +new_mntfs() { return alloc_mntfs(&efs_ops, (am_opts *) 0, "//nil//", ".", "", "", ""); } -static void uninit_mntfs(mf, rmd) -mntfs *mf; -int rmd; +static void +uninit_mntfs(mntfs *mf, int rmd) { if (mf->mf_auto) free((voidp) mf->mf_auto); if (mf->mf_mopts) free((voidp) mf->mf_mopts); @@ -262,8 +243,8 @@ int rmd; } } -static void discard_mntfs(mf) -mntfs *mf; +static void +discard_mntfs(mntfs *mf) { rem_que(&mf->mf_q); /* @@ -275,7 +256,8 @@ mntfs *mf; --mntfs_allocated; } -void flush_mntfs() +void +flush_mntfs() { mntfs *mf; @@ -288,8 +270,8 @@ void flush_mntfs() } } -void free_mntfs(mf) -mntfs *mf; +void +free_mntfs(mntfs *mf) { if (--mf->mf_refc == 0) { if (mf->mf_flags & MFF_MOUNTED) { @@ -329,18 +311,12 @@ mntfs *mf; } } -mntfs *realloc_mntfs P((mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char *mopts, char *remopts)); -mntfs *realloc_mntfs(mf, ops, mo, mp, info, auto_opts, mopts, remopts) -mntfs *mf; -am_ops *ops; -am_opts *mo; -char *mp; -char *info; -char *auto_opts; -char *mopts; -char *remopts; +mntfs * +realloc_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, + char *info, char *auto_opts, char *mopts, char *remopts) { mntfs *mf2; + if (mf->mf_refc == 1 && mf->mf_ops == &ifs_ops && STREQ(mf->mf_mount, mp)) { /* * If we are inheriting then just return diff --git a/usr.sbin/amd/amd/mount_fs.c b/usr.sbin/amd/amd/mount_fs.c index d40d9ce46df..d832f4fd342 100644 --- a/usr.sbin/amd/amd/mount_fs.c +++ b/usr.sbin/amd/amd/mount_fs.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)mount_fs.c 8.1 (Berkeley) 6/6/93 - * $Id: mount_fs.c,v 1.7 2002/06/11 05:29:54 itojun Exp $ + * $Id: mount_fs.c,v 1.8 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -87,8 +87,8 @@ struct opt_tab mnt_flags[] = { { 0, 0 } }; -int compute_mount_flags(mnt) -struct mntent *mnt; +int +compute_mount_flags(struct mntent *mnt) { struct opt_tab *opt; int flags; @@ -107,13 +107,9 @@ struct mntent *mnt; return flags; } -int mount_fs P((struct mntent *mnt, int flags, caddr_t mnt_data, int retry, MTYPE_TYPE type)); -int mount_fs(mnt, flags, mnt_data, retry, type) -struct mntent *mnt; -int flags; -caddr_t mnt_data; -int retry; -MTYPE_TYPE type; +int +mount_fs(struct mntent *mnt, int flags, caddr_t mnt_data, int retry, + MTYPE_TYPE type) { int error = 0; #ifdef MNTINFO_DEV @@ -217,8 +213,8 @@ again: #include <ctype.h> -static char *nextmntopt(p) -char **p; +static char * +nextmntopt(char **p) { char *cp = *p; char *rp; @@ -250,14 +246,14 @@ char **p; return rp; } -char *hasmntopt(mnt, opt) -struct mntent *mnt; -char *opt; +char * +hasmntopt(struct mntent *mnt, char *opt) { char t[MNTMAXSTR]; char *f; char *o = t; int l = strlen(opt); + strlcpy(t, mnt->mnt_opts, sizeof(t)); while (*(f = nextmntopt(&o))) diff --git a/usr.sbin/amd/amd/mtab.c b/usr.sbin/amd/amd/mtab.c index 2df4a70ad5c..45f8befbc5f 100644 --- a/usr.sbin/amd/amd/mtab.c +++ b/usr.sbin/amd/amd/mtab.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)mtab.c 8.1 (Berkeley) 6/6/93 - * $Id: mtab.c,v 1.2 2001/03/02 06:22:04 deraadt Exp $ + * $Id: mtab.c,v 1.3 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -44,9 +44,8 @@ /* * Firewall /etc/mtab entries */ -void mnt_free P((struct mntent *mp)); -void mnt_free(mp) -struct mntent *mp; +void +mnt_free(struct mntent *mp) { free(mp->mnt_fsname); free(mp->mnt_dir); @@ -58,9 +57,8 @@ struct mntent *mp; /* * Discard memory allocated for mount list */ -void discard_mntlist P((mntlist *mp)); -void discard_mntlist(mp) -mntlist *mp; +void +discard_mntlist(mntlist *mp) { mntlist *mp2; @@ -75,9 +73,8 @@ mntlist *mp; /* * Throw away a mount list */ -void free_mntlist P((mntlist *mp)); -void free_mntlist(mp) -mntlist *mp; +void +free_mntlist(mntlist *mp) { discard_mntlist(mp); unlock_mntlist(); @@ -88,10 +85,8 @@ mntlist *mp; * numeric option in the mount options (such as port=%d). * Returns 0 if the option is not specified. */ -int hasmntval P((struct mntent *mnt, char *opt)); -int hasmntval(mnt, opt) -struct mntent *mnt; -char *opt; +int +hasmntval(struct mntent *mnt, char *opt) { char *str = hasmntopt(mnt, opt); if (str) { diff --git a/usr.sbin/amd/amd/nfs_ops.c b/usr.sbin/amd/amd/nfs_ops.c index c5b93400521..be75d704bf8 100644 --- a/usr.sbin/amd/amd/nfs_ops.c +++ b/usr.sbin/amd/amd/nfs_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_ops.c,v 1.14 2002/07/18 02:03:00 deraadt Exp $ */ +/* $OpenBSD: nfs_ops.c,v 1.15 2002/08/03 08:29:31 pvalchev Exp $ */ /*- * Copyright (c) 1990 Jan-Simon Pendry @@ -40,7 +40,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)nfs_ops.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$OpenBSD: nfs_ops.c,v 1.14 2002/07/18 02:03:00 deraadt Exp $"; +static char *rcsid = "$OpenBSD: nfs_ops.c,v 1.15 2002/08/03 08:29:31 pvalchev Exp $"; #endif /* not lint */ #include "am.h" @@ -120,7 +120,8 @@ static int call_mountd(fh_cache*, unsigned long, fwd_fun, voidp); AUTH *nfs_auth; -static fh_cache *find_nfs_fhandle_cache(voidp idv, int done) +static fh_cache * +find_nfs_fhandle_cache(voidp idv, int done) { fh_cache *fp, *fp2 = 0; /* XXX EVIL XXX */ @@ -152,8 +153,9 @@ static fh_cache *find_nfs_fhandle_cache(voidp idv, int done) /* * Called when a filehandle appears */ -static void got_nfs_fh(voidp pkt, int len, struct sockaddr_in *sa, - struct sockaddr_in *ia, voidp idv, int done) +static void +got_nfs_fh(voidp pkt, int len, struct sockaddr_in *sa, + struct sockaddr_in *ia, voidp idv, int done) { fh_cache *fp = find_nfs_fhandle_cache(idv, done); if (fp) { @@ -178,7 +180,8 @@ static void got_nfs_fh(voidp pkt, int len, struct sockaddr_in *sa, } } -void flush_nfs_fhandle_cache(fserver *fs) +void +flush_nfs_fhandle_cache(fserver *fs) { fh_cache *fp; ITER(fp, fh_cache, &fh_head) { @@ -189,7 +192,8 @@ void flush_nfs_fhandle_cache(fserver *fs) } } -static void discard_fh(fh_cache *fp) +static void +discard_fh(fh_cache *fp) { rem_que(&fp->fh_q); #ifdef DEBUG @@ -203,7 +207,8 @@ static void discard_fh(fh_cache *fp) /* * Determine the file handle for a node */ -static int prime_nfs_fhandle_cache(char *path, fserver *fs, fhstatus *fhbuf, voidp wchan) +static int +prime_nfs_fhandle_cache(char *path, fserver *fs, fhstatus *fhbuf, voidp wchan) { fh_cache *fp, *fp_save = 0; int error; @@ -322,7 +327,8 @@ static int prime_nfs_fhandle_cache(char *path, fserver *fs, fhstatus *fhbuf, voi return error; } -int make_nfs_auth(void) +int +make_nfs_auth(void) { #ifdef HAS_NFS_QUALIFIED_NAMES /* @@ -341,7 +347,8 @@ int make_nfs_auth(void) return 0; } -static int call_mountd(fh_cache *fp, u_long proc, fwd_fun f, voidp wchan) +static int +call_mountd(fh_cache *fp, u_long proc, fwd_fun f, voidp wchan) { struct rpc_msg mnt_msg; int len; @@ -397,7 +404,8 @@ static int call_mountd(fh_cache *fp, u_long proc, fwd_fun f, voidp wchan) * remote hostname. * Local filesystem defaults to remote and vice-versa. */ -static char *nfs_match(am_opts *fo) +static char * +nfs_match(am_opts *fo) { char *xmtab; if (fo->opt_fs && !fo->opt_rfs) @@ -427,7 +435,8 @@ static char *nfs_match(am_opts *fo) /* * Initialise am structure for nfs */ -static int nfs_init(mntfs *mf) +static int +nfs_init(mntfs *mf) { if (!mf->mf_private) { int error; @@ -449,7 +458,9 @@ static int nfs_init(mntfs *mf) return 0; } -int mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts, mntfs *mf) +int +mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts, + mntfs *mf) { struct nfs_args nfs_args; struct mntent mnt; @@ -663,7 +674,8 @@ int mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts, mntfs *mf) return error; } -static int mount_nfs(char *dir, char *fs_name, char *opts, mntfs *mf) +static int +mount_nfs(char *dir, char *fs_name, char *opts, mntfs *mf) { #ifdef notdef int error; @@ -691,7 +703,8 @@ static int mount_nfs(char *dir, char *fs_name, char *opts, mntfs *mf) return mount_nfs_fh((fhstatus *) mf->mf_private, dir, fs_name, opts, mf); } -static int nfs_fmount(mntfs *mf) +static int +nfs_fmount(mntfs *mf) { int error; @@ -706,7 +719,8 @@ static int nfs_fmount(mntfs *mf) return error; } -static int nfs_fumount(mntfs *mf) +static int +nfs_fumount(mntfs *mf) { int error = UMOUNT_FS(mf->mf_mount); if (error) @@ -715,7 +729,8 @@ static int nfs_fumount(mntfs *mf) return 0; } -static void nfs_umounted(am_node *mp) +static void +nfs_umounted(am_node *mp) { #ifdef INFORM_MOUNTD /* diff --git a/usr.sbin/amd/amd/nfs_start.c b/usr.sbin/amd/amd/nfs_start.c index e3cc5e167c0..253e458033d 100644 --- a/usr.sbin/amd/amd/nfs_start.c +++ b/usr.sbin/amd/amd/nfs_start.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)nfs_start.c 8.1 (Berkeley) 6/6/93 - * $Id: nfs_start.c,v 1.9 2002/07/18 02:03:00 deraadt Exp $ + * $Id: nfs_start.c,v 1.10 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -69,7 +69,8 @@ int max_fds = -1; /* * Check that we are not burning resources */ -static void checkup(P_void) +static void +checkup(P_void) { static int max_fd = 0; static char *max_mem = 0; @@ -99,15 +100,13 @@ static void checkup(P_void) } #endif /* DEBUG */ -static int do_select(mask, omask, fds, fdp, tvp) -sigset_t *mask; -sigset_t *omask; -int fds; -fd_set *fdp; -struct timeval *tvp; +static int +do_select(sigset_t *mask, sigset_t *omask, int fds, fd_set *fdp, + struct timeval *tvp) { int sig; int nsel; + if ((sig = setjmp(select_intr))) { select_intr_valid = 0; /* Got a signal */ @@ -156,7 +155,8 @@ struct timeval *tvp; * Determine whether anything is left in * the RPC input queue. */ -static int rpc_pending_now() +static int +rpc_pending_now() { struct timeval tvv; int nsel; @@ -197,7 +197,8 @@ static int rpc_pending_now() return(0); } -static serv_state run_rpc(P_void) +static serv_state +run_rpc(P_void) { sigset_t mask, omask; @@ -362,7 +363,8 @@ static serv_state run_rpc(P_void) return amd_state; } -static int bindnfs_port(int so) +static int +bindnfs_port(int so) { unsigned short port; int error = bind_resv_port(so, &port); @@ -371,7 +373,8 @@ static int bindnfs_port(int so) return error; } -void unregister_amq(P_void) +void +unregister_amq(P_void) { #ifdef DEBUG Debug(D_AMQ) @@ -379,7 +382,8 @@ void unregister_amq(P_void) (void) pmap_unset(AMQ_PROGRAM, AMQ_VERSION); } -int mount_automounter(pid_t ppid) +int +mount_automounter(pid_t ppid) { int so = socket(AF_INET, SOCK_DGRAM, 0); SVCXPRT *amqp; diff --git a/usr.sbin/amd/amd/nfs_subr.c b/usr.sbin/amd/amd/nfs_subr.c index d5871524f53..5b58b10c5d4 100644 --- a/usr.sbin/amd/amd/nfs_subr.c +++ b/usr.sbin/amd/amd/nfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)nfs_subr.c 8.1 (Berkeley) 6/6/93 - * $Id: nfs_subr.c,v 1.2 2002/07/18 00:50:23 pvalchev Exp $ + * $Id: nfs_subr.c,v 1.3 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -53,7 +53,8 @@ NFS_ERROR_MAPPING #define nfs_error(e) ((nfsstat)(e)) #endif /* NFS_ERROR_MAPPING */ -static char *do_readlink(am_node *mp, int *error_return, struct attrstat **attrpp) +static char * +do_readlink(am_node *mp, int *error_return, struct attrstat **attrpp) { char *ln; @@ -82,7 +83,8 @@ static char *do_readlink(am_node *mp, int *error_return, struct attrstat **attrp } /*ARGSUSED*/ -voidp nfsproc_null_2(voidp argp, struct svc_req *rqstp) +voidp +nfsproc_null_2(voidp argp, struct svc_req *rqstp) { static char res; @@ -91,8 +93,8 @@ voidp nfsproc_null_2(voidp argp, struct svc_req *rqstp) /*ARGSUSED*/ -struct attrstat *nfsproc_getattr_2(struct nfs_fh *argp, - struct svc_req *rqstp) +struct attrstat * +nfsproc_getattr_2(struct nfs_fh *argp, struct svc_req *rqstp) { static struct attrstat res; am_node *mp; @@ -138,8 +140,8 @@ getattr_retry: /*ARGSUSED*/ -struct attrstat *nfsproc_setattr_2(struct sattrargs *argp, - struct svc_req *rqstp) +struct attrstat * +nfsproc_setattr_2(struct sattrargs *argp, struct svc_req *rqstp) { static struct attrstat res; @@ -153,7 +155,8 @@ struct attrstat *nfsproc_setattr_2(struct sattrargs *argp, /*ARGSUSED*/ -voidp nfsproc_root_2(voidp argp, struct svc_req *rqstp) +voidp +nfsproc_root_2(voidp argp, struct svc_req *rqstp) { static char res; @@ -162,8 +165,8 @@ voidp nfsproc_root_2(voidp argp, struct svc_req *rqstp) /*ARGSUSED*/ -struct diropres *nfsproc_lookup_2(struct diropargs *argp, - struct svc_req *rqstp) +struct diropres * +nfsproc_lookup_2(struct diropargs *argp, struct svc_req *rqstp) { static struct diropres res; am_node *mp; @@ -210,8 +213,8 @@ struct diropres *nfsproc_lookup_2(struct diropargs *argp, /*ARGSUSED*/ -struct readlinkres *nfsproc_readlink_2(struct nfs_fh *argp, - struct svc_req *rqstp) +struct readlinkres * +nfsproc_readlink_2(struct nfs_fh *argp, struct svc_req *rqstp) { static struct readlinkres res; am_node *mp; @@ -247,8 +250,8 @@ readlink_retry: /*ARGSUSED*/ -struct readres *nfsproc_read_2(struct readargs *argp, - struct svc_req *rqstp) +struct readres * +nfsproc_read_2(struct readargs *argp, struct svc_req *rqstp) { static struct readres res; @@ -261,7 +264,8 @@ struct readres *nfsproc_read_2(struct readargs *argp, /*ARGSUSED*/ -voidp nfsproc_writecache_2(voidp argp, struct svc_req *rqstp) +voidp +nfsproc_writecache_2(voidp argp, struct svc_req *rqstp) { static char res; @@ -270,8 +274,8 @@ voidp nfsproc_writecache_2(voidp argp, struct svc_req *rqstp) /*ARGSUSED*/ -struct attrstat *nfsproc_write_2(writeargs *argp, - struct svc_req *rqstp) +struct attrstat * +nfsproc_write_2(writeargs *argp, struct svc_req *rqstp) { static struct attrstat res; @@ -285,8 +289,8 @@ struct attrstat *nfsproc_write_2(writeargs *argp, /*ARGSUSED*/ -struct diropres *nfsproc_create_2(createargs *argp, - struct svc_req *rqstp) +struct diropres * +nfsproc_create_2(createargs *argp, struct svc_req *rqstp) { static struct diropres res; @@ -300,13 +304,15 @@ struct diropres *nfsproc_create_2(createargs *argp, /*ARGSUSED*/ -static nfsstat *unlink_or_rmdir(struct diropargs *argp, - struct svc_req *rqstp, int unlinkp) +static nfsstat * +unlink_or_rmdir(struct diropargs *argp, struct svc_req *rqstp, + int unlinkp) { static nfsstat res; int retry; /*mntfs *mf;*/ am_node *mp = fh_to_mp3(&argp->dir, &retry, VLOOK_DELETE); + if (mp == 0) { if (retry < 0) return 0; @@ -346,13 +352,15 @@ out: /*ARGSUSED*/ -nfsstat *nfsproc_remove_2(struct diropargs *argp, struct svc_req *rqstp) +nfsstat * +nfsproc_remove_2(struct diropargs *argp, struct svc_req *rqstp) { return unlink_or_rmdir(argp, rqstp, TRUE); } /*ARGSUSED*/ -nfsstat *nfsproc_rename_2(renameargs *argp, struct svc_req *rqstp) +nfsstat * +nfsproc_rename_2(renameargs *argp, struct svc_req *rqstp) { static nfsstat res; if (!fh_to_mp(&argp->from.dir) || !fh_to_mp(&argp->to.dir)) @@ -373,7 +381,8 @@ nfsstat *nfsproc_rename_2(renameargs *argp, struct svc_req *rqstp) /*ARGSUSED*/ -nfsstat *nfsproc_link_2(linkargs *argp, struct svc_req *rqstp) +nfsstat * +nfsproc_link_2(linkargs *argp, struct svc_req *rqstp) { static nfsstat res; if (!fh_to_mp(&argp->from) || !fh_to_mp(&argp->to.dir)) @@ -386,7 +395,8 @@ nfsstat *nfsproc_link_2(linkargs *argp, struct svc_req *rqstp) /*ARGSUSED*/ -nfsstat *nfsproc_symlink_2(symlinkargs *argp, struct svc_req *rqstp) +nfsstat * +nfsproc_symlink_2(symlinkargs *argp, struct svc_req *rqstp) { static nfsstat res; if (!fh_to_mp(&argp->from.dir)) @@ -399,7 +409,8 @@ nfsstat *nfsproc_symlink_2(symlinkargs *argp, struct svc_req *rqstp) /*ARGSUSED*/ -struct diropres *nfsproc_mkdir_2(createargs *argp, struct svc_req *rqstp) +struct diropres * +nfsproc_mkdir_2(createargs *argp, struct svc_req *rqstp) { static struct diropres res; if (!fh_to_mp(&argp->where.dir)) @@ -412,15 +423,16 @@ struct diropres *nfsproc_mkdir_2(createargs *argp, struct svc_req *rqstp) /*ARGSUSED*/ -nfsstat *nfsproc_rmdir_2(struct diropargs *argp, struct svc_req *rqstp) +nfsstat * +nfsproc_rmdir_2(struct diropargs *argp, struct svc_req *rqstp) { return unlink_or_rmdir(argp, rqstp, FALSE); } /*ARGSUSED*/ -struct readdirres *nfsproc_readdir_2(readdirargs *argp, - struct svc_req *rqstp) +struct readdirres * +nfsproc_readdir_2(readdirargs *argp, struct svc_req *rqstp) { static readdirres res; static entry e_res[MAX_READDIR_ENTRIES]; @@ -451,8 +463,8 @@ struct readdirres *nfsproc_readdir_2(readdirargs *argp, } /*ARGSUSED*/ -struct statfsres *nfsproc_statfs_2(struct nfs_fh *argp, - struct svc_req *rqstp) +struct statfsres * +nfsproc_statfs_2(struct nfs_fh *argp, struct svc_req *rqstp) { static statfsres res; am_node *mp; diff --git a/usr.sbin/amd/amd/nfsx_ops.c b/usr.sbin/amd/amd/nfsx_ops.c index e5ba0bacbb1..25b61379092 100644 --- a/usr.sbin/amd/amd/nfsx_ops.c +++ b/usr.sbin/amd/amd/nfsx_ops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)nfsx_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: nfsx_ops.c,v 1.3 2002/07/18 02:03:00 deraadt Exp $ + * $Id: nfsx_ops.c,v 1.4 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -64,10 +64,10 @@ struct nfsx { nfsx_mnt *nx_try; }; -static int nfsx_fmount P((mntfs*)); +static int nfsx_fmount(mntfs *); -static char *nfsx_match(fo) -am_opts *fo; +static char * +nfsx_match(am_opts *fo) { char *xmtab; char *ptr; @@ -130,9 +130,8 @@ am_opts *fo; return xmtab; } -static void nfsx_prfree P((voidp vp)); -static void nfsx_prfree(vp) -voidp vp; +static void +nfsx_prfree(voidp vp) { struct nfsx *nx = (struct nfsx *) vp; int i; @@ -147,8 +146,8 @@ voidp vp; free((voidp) nx); } -static int nfsx_init(mf) -mntfs *mf; +static int +nfsx_init(mntfs *mf) { /* * mf_info has the form: @@ -270,11 +269,8 @@ errexit: return glob_error; } -static void nfsx_cont P((int rc, int term, voidp closure)); -static void nfsx_cont(rc, term, closure) -int rc; -int term; -voidp closure; +static void +nfsx_cont(int rc, int term, voidp closure) { mntfs *mf = (mntfs *) closure; struct nfsx *nx = (struct nfsx *) mf->mf_private; @@ -325,9 +321,8 @@ voidp closure; } } -static int try_nfsx_mount P((voidp mv)); -static int try_nfsx_mount(mv) -voidp mv; +static int +try_nfsx_mount(voidp mv) { mntfs *mf = (mntfs *) mv; int error; @@ -338,10 +333,8 @@ voidp mv; return error; } -static int nfsx_remount P((mntfs *mf, int fg)); -static int nfsx_remount(mf, fg) -mntfs *mf; -int fg; +static int +nfsx_remount(mntfs *mf, int fg) { struct nfsx *nx = (struct nfsx *) mf->mf_private; nfsx_mnt *n; @@ -408,9 +401,8 @@ int fg; return glob_error < 0 ? 0 : glob_error; } -static int nfsx_fmount P((mntfs *mf)); -static int nfsx_fmount(mf) -mntfs *mf; +static int +nfsx_fmount(mntfs *mf) { return nfsx_remount(mf, FALSE); } @@ -420,8 +412,8 @@ mntfs *mf; * Note that this is called in the foreground * and so may hang under extremely rare conditions. */ -static int nfsx_fumount(mf) -mntfs *mf; +static int +nfsx_fumount(mntfs *mf) { struct nfsx *nx = (struct nfsx *) mf->mf_private; nfsx_mnt *n; diff --git a/usr.sbin/amd/amd/opts.c b/usr.sbin/amd/amd/opts.c index bea273124d3..7a7d078d6db 100644 --- a/usr.sbin/amd/amd/opts.c +++ b/usr.sbin/amd/amd/opts.c @@ -38,13 +38,11 @@ #ifndef lint /*static char sccsid[] = "from: @(#)opts.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: opts.c,v 1.3 2002/06/11 05:29:54 itojun Exp $"; +static char *rcsid = "$Id: opts.c,v 1.4 2002/08/03 08:29:31 pvalchev Exp $"; #endif /* not lint */ #include "am.h" -extern char *getenv P((const char *)); - /* * static copy of the options with * which to play @@ -170,9 +168,8 @@ static opt_apply to_free[] = { /* * Skip to next option in the string */ -static char *opt P((char**)); -static char *opt(p) -char **p; +static char * +opt(char **p) { char *cp = *p; char *dp = cp; @@ -215,10 +212,8 @@ top: return s; } -static int eval_opts P((char*, char*)); -static int eval_opts(opts, mapkey) -char *opts; -char *mapkey; +static int +eval_opts(char *opts, char *mapkey) { /* * Fill in the global structure fs_static by @@ -326,11 +321,9 @@ char *mapkey; /* * Free an option */ -static void free_op P((opt_apply*, int)); /*ARGSUSED*/ -static void free_op(p, b) -opt_apply *p; -int b; +static void +free_op(opt_apply *p, int b) { if (*p->opt) { free(*p->opt); @@ -341,9 +334,8 @@ int b; /* * Normalize slashes in the string. */ -void normalize_slash P((char *p)); -void normalize_slash(p) -char *p; +void +normalize_slash(char *p) { char *f = strchr(p, '/'); char *f0 = f; @@ -384,10 +376,8 @@ char *p; * If sel is true then old expand selectors, otherwise * don't expand selectors. */ -static void expand_op P((opt_apply*, int)); -static void expand_op(p, sel_p) -opt_apply *p; -int sel_p; +static void +expand_op(opt_apply *p, int sel_p) { /* * The BUFSPACE macros checks that there is enough space @@ -671,10 +661,8 @@ out: /* * Wrapper for expand_op */ -static void expand_opts P((opt_apply*, int)); -static void expand_opts(p, sel_p) -opt_apply *p; -int sel_p; +static void +expand_opts(opt_apply *p, int sel_p) { if (*p->opt) { expand_op(p, sel_p); @@ -693,10 +681,8 @@ int sel_p; /* * Apply a function to a list of options */ -static void apply_opts(op, ppp, b) -void (*op)(); -opt_apply ppp[]; -int b; +static void +apply_opts(void (*op)(), opt_apply ppp[], int b) { opt_apply *pp; for (pp = ppp; pp->opt; pp++) @@ -706,8 +692,8 @@ int b; /* * Free the option table */ -void free_opts(fo) -am_opts *fo; +void +free_opts(am_opts *fo) { /* * Copy in the structure we are playing with @@ -723,8 +709,8 @@ am_opts *fo; /* * Expand lookup key */ -char *expand_key(key) -char *key; +char * +expand_key(char *key) { opt_apply oa; @@ -738,9 +724,8 @@ char *key; * Remove trailing /'s from a string * unless the string is a single / (Steven Glassman) */ -void deslashify P((char *s)); -void deslashify(s) -char *s; +void +deslashify(char *s) { if (s && *s) { char *sl = s + strlen(s); @@ -749,9 +734,9 @@ char *s; } } -int eval_fs_opts(fo, opts, g_opts, path, key, map) -am_opts *fo; -char *opts, *g_opts, *path, *key, *map; +int +eval_fs_opts(am_opts *fo, char *opts, char *g_opts, char *path, + char *key, char *map) { int ok = TRUE; diff --git a/usr.sbin/amd/amd/pfs_ops.c b/usr.sbin/amd/amd/pfs_ops.c index 93ea8078ef2..6031403107b 100644 --- a/usr.sbin/amd/amd/pfs_ops.c +++ b/usr.sbin/amd/amd/pfs_ops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)pfs_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: pfs_ops.c,v 1.3 2002/07/18 02:03:00 deraadt Exp $ + * $Id: pfs_ops.c,v 1.4 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -52,10 +52,11 @@ /* * Execute needs a mount and unmount command. */ -static char *pfs_match(fo) -am_opts *fo; +static char * +pfs_match(am_opts *fo) { char *prog; + if (!fo->opt_mount || !fo->opt_unmount) { plog(XLOG_USER, "program: no mount/unmount specified"); return 0; @@ -64,8 +65,8 @@ am_opts *fo; return strdup(prog ? prog+1 : fo->opt_mount); } -static int pfs_init(mf) -mntfs *mf; +static int +pfs_init(mntfs *mf) { /* * Save unmount command @@ -77,8 +78,8 @@ mntfs *mf; return 0; } -static int pfs_exec(info) -char *info; +static int +pfs_exec(char *info) { char **xivec; int error; @@ -134,14 +135,14 @@ char *info; return error; } -static int pfs_fmount(mf) -mntfs *mf; +static int +pfs_fmount(mntfs *mf) { return pfs_exec(mf->mf_fo->opt_mount); } -static int pfs_fumount(mf) -mntfs *mf; +static int +pfs_fumount(mntfs *mf) { return pfs_exec((char *) mf->mf_private); } diff --git a/usr.sbin/amd/amd/restart.c b/usr.sbin/amd/amd/restart.c index b85b0a4c207..be46434bb40 100644 --- a/usr.sbin/amd/amd/restart.c +++ b/usr.sbin/amd/amd/restart.c @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)restart.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: restart.c,v 1.2 2002/07/18 02:03:00 deraadt Exp $"; +static char *rcsid = "$Id: restart.c,v 1.3 2002/08/03 08:29:31 pvalchev Exp $"; #endif /* not lint */ #include "am.h" @@ -55,7 +55,8 @@ static char *rcsid = "$Id: restart.c,v 1.2 2002/07/18 02:03:00 deraadt Exp $"; * This module relies on internal details of other components. If * you change something else make *sure* restart() still works. */ -void restart() +void +restart() { /* * Read the existing mount table diff --git a/usr.sbin/amd/amd/rpc_fwd.c b/usr.sbin/amd/amd/rpc_fwd.c index 906aadae330..b246bb8bfad 100644 --- a/usr.sbin/amd/amd/rpc_fwd.c +++ b/usr.sbin/amd/amd/rpc_fwd.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)rpc_fwd.c 8.1 (Berkeley) 6/6/93 - * $Id: rpc_fwd.c,v 1.3 2002/07/18 02:03:00 deraadt Exp $ + * $Id: rpc_fwd.c,v 1.4 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -93,7 +93,8 @@ int fwd_sock; /* * Allocate a rely structure */ -static rpc_forward *fwd_alloc() +static rpc_forward * +fwd_alloc() { time_t now = clocktime(); rpc_forward *p = 0, *p2; @@ -149,8 +150,8 @@ static rpc_forward *fwd_alloc() * First unlink it from the list, then * discard it. */ -static void fwd_free(p) -rpc_forward *p; +static void +fwd_free(rpc_forward *p) { #ifdef DEBUG /*dlog("fwd_free: rpc_head = %#x", rpc_head.q_forw);*/ @@ -196,8 +197,8 @@ int fwd_init() /* * Locate a packet in the forwarding list */ -static rpc_forward *fwd_locate(id) -u_int id; +static rpc_forward * +fwd_locate(u_int id) { rpc_forward *p; @@ -217,13 +218,9 @@ u_int id; * would not work because it might come from a * different address. */ -int fwd_packet(type_id, pkt, len, fwdto, replyto, i, cb) -int type_id; -voidp pkt; -int len; -struct sockaddr_in *fwdto, *replyto; -voidp i; -fwd_fun cb; +int +fwd_packet(int type_id, voidp pkt, int len, struct sockaddr_in *fwdto, + struct sockaddr_in *replyto, voidp i, fwd_fun cb) { rpc_forward *p; u_int *pkt_int; @@ -318,7 +315,8 @@ fwd_fun cb; /* * Called when some data arrives on the forwarding socket */ -void fwd_reply() +void +fwd_reply() { int len; #ifdef DYNAMIC_BUFFERS diff --git a/usr.sbin/amd/amd/sched.c b/usr.sbin/amd/amd/sched.c index ad624f2db33..4b6c90979f5 100644 --- a/usr.sbin/amd/amd/sched.c +++ b/usr.sbin/amd/amd/sched.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)sched.c 8.1 (Berkeley) 6/6/93 - * $Id: sched.c,v 1.6 2002/05/26 10:37:58 deraadt Exp $ + * $Id: sched.c,v 1.7 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -67,8 +67,8 @@ qelem proc_wait_list = { &proc_wait_list, &proc_wait_list }; int task_notify_todo; -void ins_que(elem, pred) -qelem *elem, *pred; +void +ins_que(qelem *elem, qelem *pred) { qelem *p = pred->q_forw; elem->q_back = pred; @@ -77,8 +77,8 @@ qelem *elem, *pred; p->q_back = elem; } -void rem_que(elem) -qelem *elem; +void +rem_que(qelem *elem) { qelem *p = elem->q_forw; qelem *p2 = elem->q_back; @@ -86,9 +86,8 @@ qelem *elem; p->q_back = p2; } -static pjob *sched_job(cf, ca) -cb_fun cf; -voidp ca; +static pjob * +sched_job(cb_fun cf, voidp ca) { pjob *p = ALLOC(pjob); @@ -103,11 +102,8 @@ voidp ca; return p; } -void run_task(tf, ta, cf, ca) -task_fun tf; -voidp ta; -cb_fun cf; -voidp ca; +void +run_task(task_fun tf, voidp ta, cb_fun cf, voidp ca) { pjob *p = sched_job(cf, ca); sigset_t mask, omask; @@ -131,10 +127,8 @@ voidp ca; /* * Schedule a task to be run when woken up */ -void sched_task(cf, ca, wchan) -cb_fun cf; -voidp ca; -voidp wchan; +void +sched_task(cb_fun cf, voidp ca, voidp wchan) { /* * Allocate a new task @@ -148,16 +142,16 @@ voidp wchan; bzero((voidp) &p->w, sizeof(p->w)); } -static void wakeupjob(p) -pjob *p; +static void +wakeupjob(pjob *p) { rem_que(&p->hdr); ins_que(&p->hdr, &proc_list_head); task_notify_todo++; } -void wakeup(wchan) -voidp wchan; +void +wakeup(voidp wchan) { pjob *p, *p2; #ifdef DEBUG_SLEEP @@ -190,18 +184,16 @@ voidp wchan; #endif } -void wakeup_task(rc, term, cl) -int rc; -int term; -voidp cl; +void +wakeup_task(int rc, int term, voidp cl) { wakeup(cl); } /*ARGSUSED*/ -void sigchld(sig) -int sig; +void +sigchld(int sig) { union wait w; int save_errno = errno; @@ -250,7 +242,8 @@ int sig; * Run any pending tasks. * This must be called with SIGCHLD disabled */ -void do_task_notify(P_void) +void +do_task_notify(P_void) { /* * Keep taking the first item off the list and processing it. diff --git a/usr.sbin/amd/amd/sfs_ops.c b/usr.sbin/amd/amd/sfs_ops.c index 2575c2ee95e..0acd22e73b0 100644 --- a/usr.sbin/amd/amd/sfs_ops.c +++ b/usr.sbin/amd/amd/sfs_ops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)sfs_ops.c 8.1 (Berkeley) 6/6/93 - * $Id: sfs_ops.c,v 1.1 1995/10/18 08:47:12 deraadt Exp $ + * $Id: sfs_ops.c,v 1.2 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" @@ -58,8 +58,8 @@ /* * SFS needs a link. */ -static char *sfs_match(fo) -am_opts *fo; +static char * +sfs_match(am_opts *fo) { if (!fo->opt_fs) { plog(XLOG_USER, "link: no fs specified"); @@ -105,9 +105,8 @@ am_opts *fo; #ifdef HAS_SFSX /*ARGUSED*/ -static int sfsx_mount P((am_node *mp)); -static int sfsx_mount(mp) -am_node *mp; +static int +sfsx_mount(am_node *mp) { /* * Check for existence of target. @@ -134,8 +133,8 @@ am_node *mp; #ifdef HAS_SFS /*ARGUSED*/ -static int sfs_fmount(mf) -mntfs *mf; +static int +sfs_fmount(mntfs *mf) { /* * Wow - this is hard to implement! @@ -147,8 +146,8 @@ mntfs *mf; #ifdef NEED_SFS_UMOUNT /*ARGUSED*/ -static int sfs_fumount(mf) -mntfs *mf; +static int +sfs_fumount(mntfs *mf) { return 0; } diff --git a/usr.sbin/amd/amd/srvr_afs.c b/usr.sbin/amd/amd/srvr_afs.c index 908833403ad..ca7bbb88fa7 100644 --- a/usr.sbin/amd/amd/srvr_afs.c +++ b/usr.sbin/amd/amd/srvr_afs.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)srvr_afs.c 8.1 (Berkeley) 6/6/93 - * $Id: srvr_afs.c,v 1.1 1995/10/18 08:47:12 deraadt Exp $ + * $Id: srvr_afs.c,v 1.2 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -53,9 +53,8 @@ static fserver *localhost; /* * Find an nfs server for the local host */ -fserver *find_afs_srvr P((mntfs *)); -fserver *find_afs_srvr(mf) -mntfs *mf; +fserver * +find_afs_srvr(mntfs *mf) { fserver *fs = localhost; @@ -89,9 +88,8 @@ mntfs *mf; /* * Wakeup anything waiting for this server */ -void wakeup_srvr P((fserver *fs)); -void wakeup_srvr(fs) -fserver *fs; +void +wakeup_srvr(fserver *fs) { fs->fs_flags &= ~FSF_WANT; wakeup((voidp) fs); @@ -100,9 +98,8 @@ fserver *fs; /* * Called when final ttl of server has expired */ -static void timeout_srvr P((fserver *fs)); -static void timeout_srvr(fs) -fserver *fs; +static void +timeout_srvr(fserver *fs) { /* * If the reference count is still zero then @@ -146,9 +143,8 @@ fserver *fs; /* * Free a file server */ -void free_srvr P((fserver *fs)); -void free_srvr(fs) -fserver *fs; +void +free_srvr(fserver *fs) { if (--fs->fs_refc == 0) { /* @@ -183,9 +179,8 @@ fserver *fs; /* * Make a duplicate fserver reference */ -fserver *dup_srvr P((fserver *fs)); -fserver *dup_srvr(fs) -fserver *fs; +fserver * +dup_srvr(fserver *fs) { fs->fs_refc++; return fs; @@ -194,10 +189,7 @@ fserver *fs; /* * Log state change */ -void srvrlog P((fserver *fs, char *state)); -void srvrlog(fs, state) -fserver *fs; -char *state; +void srvrlog(fserver *fs, char *state) { plog(XLOG_INFO, "file server %s type %s %s", fs->fs_host, fs->fs_type, state); } diff --git a/usr.sbin/amd/amd/srvr_nfs.c b/usr.sbin/amd/amd/srvr_nfs.c index 8c872ae4d6c..6a99c9299d8 100644 --- a/usr.sbin/amd/amd/srvr_nfs.c +++ b/usr.sbin/amd/amd/srvr_nfs.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)srvr_nfs.c 8.1 (Berkeley) 6/6/93 - * $Id: srvr_nfs.c,v 1.3 2002/07/18 02:03:00 deraadt Exp $ + * $Id: srvr_nfs.c,v 1.4 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -91,8 +91,8 @@ static char ping_buf[sizeof(struct rpc_msg) + 32]; /* * Flush any cached data */ -void flush_srvr_nfs_cache P((void)); -void flush_srvr_nfs_cache() +void +flush_srvr_nfs_cache(void) { fserver *fs = 0; @@ -108,8 +108,8 @@ void flush_srvr_nfs_cache() /* * Startup the NFS ping */ -static void start_ping(P_void); -static void start_ping() +static void +start_ping(P_void) { XDR ping_xdr; struct rpc_msg ping_msg; @@ -145,14 +145,9 @@ static void start_ping() * Called when a portmap reply arrives */ /*ARGSUSED*/ -static void got_portmap P((voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in *ia, voidp idv, int done)); -static void got_portmap(pkt, len, sa, ia, idv, done) -voidp pkt; -int len; -struct sockaddr_in *sa; -struct sockaddr_in *ia; -voidp idv; -int done; +static void +got_portmap(voidp pkt, int len, struct sockaddr_in *sa, + struct sockaddr_in *ia, voidp idv, int done) { fserver *fs2 = (fserver *) idv; fserver *fs = 0; @@ -206,11 +201,9 @@ int done; /* * Obtain portmap information */ -static int call_portmap P((fserver *fs, AUTH *auth, unsigned long prog, unsigned long vers, unsigned long prot)); -static int call_portmap(fs, auth, prog, vers, prot) -fserver *fs; -AUTH *auth; -unsigned long prog, vers, prot; +static int +call_portmap(fserver *fs, AUTH *auth, unsigned long prog, + unsigned long vers, unsigned long prot) { struct rpc_msg pmap_msg; int len; @@ -238,11 +231,10 @@ unsigned long prog, vers, prot; return error; } -static void nfs_keepalive P((fserver*)); +static void nfs_keepalive(fserver *); -static void recompute_portmap P((fserver *fs)); -static void recompute_portmap(fs) -fserver *fs; +static void +recompute_portmap(fserver *fs) { int error; @@ -266,14 +258,9 @@ fserver *fs; * structure when the ping was transmitted. */ /*ARGSUSED*/ -static void nfs_pinged P((voidp pkt, int len, struct sockaddr_in *sp, struct sockaddr_in *tsp, voidp idv, int done)); -static void nfs_pinged(pkt, len, sp, tsp, idv, done) -voidp pkt; -int len; -struct sockaddr_in *sp; -struct sockaddr_in *tsp; -voidp idv; -int done; +static void +nfs_pinged(voidp pkt, int len, struct sockaddr_in *sp, + struct sockaddr_in *tsp, voidp idv, int done) { /* XXX EVIL! XXX */ int xid = (int) ((long)idv); @@ -372,9 +359,8 @@ int done; /* * Called when no ping-reply received */ -static void nfs_timed_out P((fserver *fs)); -static void nfs_timed_out(fs) -fserver *fs; +static void +nfs_timed_out(fserver *fs) { nfs_private *np = (nfs_private *) fs->fs_private; @@ -444,9 +430,8 @@ fserver *fs; /* * Keep track of whether a server is alive */ -static void nfs_keepalive P((fserver *fs)); -static void nfs_keepalive(fs) -fserver *fs; +static void +nfs_keepalive(fserver *fs) { int error; nfs_private *np = (nfs_private *) fs->fs_private; @@ -524,11 +509,8 @@ fserver *fs; fs->fs_cid = timeout(fstimeo, nfs_timed_out, (voidp) fs); } -int nfs_srvr_port P((fserver *fs, u_short *port, voidp wchan)); -int nfs_srvr_port(fs, port, wchan) -fserver *fs; -u_short *port; -voidp wchan; +int +nfs_srvr_port(fserver *fs, u_short *port, voidp wchan) { int error = -1; if ((fs->fs_flags & FSF_VALID) == FSF_VALID) { @@ -571,10 +553,8 @@ voidp wchan; return error; } -static void start_nfs_pings P((fserver *fs, int pingval)); -static void start_nfs_pings(fs, pingval) -fserver *fs; -int pingval; +static void +start_nfs_pings(fserver *fs, int pingval) { if (!(fs->fs_flags & FSF_PINGING)) { fs->fs_flags |= FSF_PINGING; @@ -597,9 +577,8 @@ int pingval; /* * Find an nfs server for a host. */ -fserver *find_nfs_srvr P((mntfs *mf)); -fserver *find_nfs_srvr(mf) -mntfs *mf; +fserver * +find_nfs_srvr(mntfs *mf) { fserver *fs; struct hostent *hp = 0; diff --git a/usr.sbin/amd/amd/ufs_ops.c b/usr.sbin/amd/amd/ufs_ops.c index e6bd07099ec..716fc3325d9 100644 --- a/usr.sbin/amd/amd/ufs_ops.c +++ b/usr.sbin/amd/amd/ufs_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_ops.c,v 1.3 2001/03/02 06:22:05 deraadt Exp $ */ +/* $OpenBSD: ufs_ops.c,v 1.4 2002/08/03 08:29:31 pvalchev Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -60,9 +60,8 @@ typedef nfs_fh fhandle_t; /* * UFS needs local filesystem and device. */ -static char *ufs_match P((am_opts *fo)); -static char *ufs_match(fo) -am_opts *fo; +static char * +ufs_match(am_opts *fo) { if (!fo->opt_dev) { plog(XLOG_USER, "ufs: no device specified"); @@ -81,10 +80,7 @@ am_opts *fo; } static int -mount_ufs(dir, fs_name, opts) -char *dir; -char *fs_name; -char *opts; +mount_ufs(char *dir, char *fs_name, char *opts) { struct ufs_args ufs_args; struct mntent mnt; @@ -124,8 +120,8 @@ char *opts; } /*ARGSUSED*/ -static int ufs_fmount(mf) -mntfs *mf; +static int +ufs_fmount(mntfs *mf) { int error; @@ -139,8 +135,8 @@ mntfs *mf; return 0; } -static int ufs_fumount(mf) -mntfs *mf; +static int +ufs_fumount(mntfs *mf) { return UMOUNT_FS(mf->mf_mount); } diff --git a/usr.sbin/amd/amd/umount_fs.c b/usr.sbin/amd/amd/umount_fs.c index 6e6ba2e1f40..3c882e8ea17 100644 --- a/usr.sbin/amd/amd/umount_fs.c +++ b/usr.sbin/amd/amd/umount_fs.c @@ -36,16 +36,15 @@ * SUCH DAMAGE. * * from: @(#)umount_fs.c 8.1 (Berkeley) 6/6/93 - * $Id: umount_fs.c,v 1.2 2002/07/18 02:03:00 deraadt Exp $ + * $Id: umount_fs.c,v 1.3 2002/08/03 08:29:31 pvalchev Exp $ */ #include "am.h" #ifdef NEED_UMOUNT_BSD -int umount_fs P((char *fs_name)); -int umount_fs(fs_name) -char *fs_name; +int +umount_fs(char *fs_name) { int error; @@ -85,8 +84,8 @@ eintr: #include <sys/mount.h> /* For MNT_NOFORCE */ -int umount_fs(fs_name) -char *fs_name; +int +umount_fs(char *fs_name) { int error; @@ -127,8 +126,8 @@ eintr: #ifdef NEED_UMOUNT_FS -int umount_fs(fs_name) -char *fs_name; +int +umount_fs(char *fs_name) { mntlist *mlist, *mp, *mp_save = 0; int error = 0; diff --git a/usr.sbin/amd/amd/util.c b/usr.sbin/amd/amd/util.c index bb65761b2f2..2785ec28f73 100644 --- a/usr.sbin/amd/amd/util.c +++ b/usr.sbin/amd/amd/util.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)util.c 8.1 (Berkeley) 6/6/93 - * $Id: util.c,v 1.7 2002/07/18 02:03:00 deraadt Exp $ + * $Id: util.c,v 1.8 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -50,9 +50,8 @@ #include <netdb.h> -char *strnsave(str, len) -Const char *str; -int len; +char * +strnsave(Const char *str, int len) { char *sp = (char *) xmalloc(len+1); @@ -62,21 +61,12 @@ int len; return sp; } -char *strdup(s) -Const char *s; -{ - return strnsave(s, strlen(s)); -} - /* * Concatenate three strings and store in buffer pointed to * by p, making p large enough to hold the strings */ -char *str3cat(p, s1, s2, s3) -char *p; -char *s1; -char *s2; -char *s3; +char * +str3cat(char *p, char *s1, char *s2, char *s3) { int l1 = strlen(s1); int l2 = strlen(s2); @@ -88,9 +78,8 @@ char *s3; return p; } -char *strealloc(p, s) -char *p; -char *s; +char * +strealloc(char *p, char *s) { int len = strlen(s) + 1; @@ -103,11 +92,8 @@ char *s; return p; } -char **strsplit P((char *s, int ch, int qc)); -char **strsplit(s, ch, qc) -char *s; -int ch; -int qc; +char ** +strsplit(char *s, int ch, int qc) { char **ivec; int ic = 0; @@ -186,9 +172,8 @@ int qc; * to skip from right to left and do partial * matches along the way -- ie more expensive. */ -static void domain_strip P((char *otherdom, char *localdom)); -static void domain_strip(otherdom, localdom) -char *otherdom, *localdom; +static void +domain_strip(char *otherdom, char *localdom) { #ifdef PARTIAL_DOMAINS char *p1 = otherdom-1; @@ -215,9 +200,8 @@ char *otherdom, *localdom; /* * Normalize a host name */ -void host_normalize P((char **chp)); -void host_normalize(chp) -char **chp; +void +host_normalize(char **chp) { /* * Normalize hosts is used to resolve host name aliases @@ -243,11 +227,8 @@ char **chp; * addr is in network byte order. * sizeof(buf) needs to be at least 16. */ -char *inet_dquad P((char *buf, size_t, u_int32_t addr)); -char *inet_dquad(buf, buflen, addr) -char *buf; -size_t buflen; -u_int32_t addr; +char * +inet_dquad(char *buf, size_t buflen, u_int32_t addr) { addr = ntohl(addr); snprintf(buf, buflen, "%d.%d.%d.%d", @@ -263,9 +244,8 @@ u_int32_t addr; * problems with macro expansions. */ static char invalid_keys[] = "\"'!;@ \t\n"; -int valid_key P((char *key)); -int valid_key(key) -char *key; +int +valid_key(char *key) { while (*key) if (strchr(invalid_keys, *key++)) @@ -273,9 +253,8 @@ char *key; return TRUE; } -void going_down P((int rc)); -void going_down(rc) -int rc; +void +going_down(int rc) { if (foreground) { if (amd_state != Start) { @@ -296,10 +275,8 @@ int rc; } -int bind_resv_port P((int so, u_short *pp)); -int bind_resv_port(so, pp) -int so; -u_short *pp; +int +bind_resv_port(int so, u_short *pp) { struct sockaddr_in sin; int rc; @@ -313,9 +290,8 @@ u_short *pp; return rc; } -void forcibly_timeout_mp P((am_node *mp)); -void forcibly_timeout_mp(mp) -am_node *mp; +void +forcibly_timeout_mp(am_node *mp) { mntfs *mf = mp->am_mnt; /* @@ -333,9 +309,8 @@ am_node *mp; } } -void mf_mounted P((mntfs *mf)); -void mf_mounted(mf) -mntfs *mf; +void +mf_mounted(mntfs *mf) { int quoted; int wasmounted = mf->mf_flags & MFF_MOUNTED; @@ -370,9 +345,8 @@ mntfs *mf; mf->mf_ops->fs_type, mf->mf_mount); } -void am_mounted P((am_node *mp)); -void am_mounted(mp) -am_node *mp; +void +am_mounted(am_node *mp) { mntfs *mf = mp->am_mnt; @@ -427,9 +401,8 @@ am_node *mp; amd_stats.d_mok++; } -int mount_node P((am_node *mp)); -int mount_node(mp) -am_node *mp; +int +mount_node(am_node *mp) { mntfs *mf = mp->am_mnt; int error; @@ -447,9 +420,8 @@ am_node *mp; return error; } -void am_unmounted P((am_node *mp)); -void am_unmounted(mp) -am_node *mp; +void +am_unmounted(am_node *mp) { mntfs *mf = mp->am_mnt; @@ -475,17 +447,15 @@ am_node *mp; free_map(mp); } -int auto_fmount P((am_node *mp)); -int auto_fmount(mp) -am_node *mp; +int +auto_fmount(am_node *mp) { mntfs *mf = mp->am_mnt; return (*mf->mf_ops->fmount_fs)(mf); } -int auto_fumount P((am_node *mp)); -int auto_fumount(mp) -am_node *mp; +int +auto_fumount(am_node *mp) { mntfs *mf = mp->am_mnt; return (*mf->mf_ops->fumount_fs)(mf); @@ -496,8 +466,8 @@ am_node *mp; * * TODO: Need a better strategy for handling errors */ -static pid_t dofork(P_void); -static pid_t dofork() +static pid_t +dofork(P_void) { pid_t pid; top: @@ -516,8 +486,8 @@ top: return pid; } -pid_t background(P_void); -pid_t background() +pid_t +background(P_void) { pid_t pid = dofork(); if (pid == 0) { @@ -533,10 +503,8 @@ pid_t background() /* * Make all the directories in the path. */ -int mkdirs P((char *path, int mode)); -int mkdirs(path, mode) -char *path; -int mode; +int +mkdirs(char *path, int mode) { /* * take a copy in case path is in readonly store @@ -602,9 +570,8 @@ int mode; * been created by Amd (not mode dr-x) or an rmdir * fails for any reason. */ -void rmdirs P((char *dir)); -void rmdirs(dir) -char *dir; +void +rmdirs(char *dir) { char *xdp = strdup(dir); char *dp; diff --git a/usr.sbin/amd/amd/wire.c b/usr.sbin/amd/amd/wire.c index 1d209430a4a..bc3f91b1728 100644 --- a/usr.sbin/amd/amd/wire.c +++ b/usr.sbin/amd/amd/wire.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)wire.c 8.1 (Berkeley) 6/6/93 - * $Id: wire.c,v 1.9 2002/07/18 02:03:00 deraadt Exp $ + * $Id: wire.c,v 1.10 2002/08/03 08:29:31 pvalchev Exp $ */ /* @@ -84,8 +84,8 @@ static addrlist *localnets = 0; #define clist (ifc.ifc_ifcu.ifcu_req) #define count (ifc.ifc_len/sizeof(struct ifreq)) -char *getwire P((void)); -char *getwire() +char * +getwire(void) { struct hostent *hp; struct netent *np; @@ -252,8 +252,8 @@ out: #else -char *getwire P((void)); -char *getwire() +char * +getwire(void) { return strdup(NO_SUBNET); } @@ -263,9 +263,8 @@ char *getwire() * Determine whether a network is on a local network * (addr) is in network byte order. */ -int islocalnet P((u_int32_t addr)); -int islocalnet(addr) -u_int32_t addr; +int +islocalnet(u_int32_t addr) { addrlist *al; diff --git a/usr.sbin/amd/amd/xutil.c b/usr.sbin/amd/amd/xutil.c index 54c8d765779..0a5befd34de 100644 --- a/usr.sbin/amd/amd/xutil.c +++ b/usr.sbin/amd/amd/xutil.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)xutil.c 8.1 (Berkeley) 6/6/93 - * $Id: xutil.c,v 1.7 2002/07/18 02:03:00 deraadt Exp $ + * $Id: xutil.c,v 1.8 2002/08/03 08:29:31 pvalchev Exp $ */ #include "config.h" @@ -48,6 +48,7 @@ #endif #include <unistd.h> +#include <stdarg.h> #include <stdlib.h> #include <sys/stat.h> @@ -58,8 +59,6 @@ int syslogging; int xlog_level = XLOG_ALL & ~XLOG_MAP & ~XLOG_STATS; int xlog_level_init = ~0; -extern char *__progname; - /* * List of log options */ @@ -79,8 +78,8 @@ struct opt_tab xlog_opt[] = { { 0, 0 } }; -voidp xmalloc(len) -int len; +voidp +xmalloc(int len) { voidp p; int retries = 600; @@ -113,9 +112,8 @@ int len; return 0; } -voidp xrealloc(ptr, len) -voidp ptr; -int len; +voidp +xrealloc(voidp ptr, int len) { #if defined(DEBUG) && defined(DEBUG_MEM) Debug(D_MEM) plog(XLOG_DEBUG, "Reallocated size %d; block %#x", len, ptr); @@ -138,10 +136,7 @@ int len; } #if defined(DEBUG) && defined(DEBUG_MEM) -xfree(f, l, p) -char *f; -int l; -voidp p; +xfree(char *f, int l, voidp p) { Debug(D_MEM) plog(XLOG_DEBUG, "Free in %s:%d: block %#x", f, l, p); #undef free @@ -151,9 +146,11 @@ voidp p; #ifdef DEBUG_MEM static int mem_bytes; static int orig_mem_bytes; -static void checkup_mem(P_void) + +static void +checkup_mem(P_void) { -extern struct mallinfo __mallinfo; + extern struct mallinfo __mallinfo; if (mem_bytes != __mallinfo.uordbytes) { if (orig_mem_bytes == 0) mem_bytes = orig_mem_bytes = __mallinfo.uordbytes; @@ -180,10 +177,8 @@ extern struct mallinfo __mallinfo; * with the current error code taken from errno. Make sure * 'e' never gets longer than maxlen characters. */ -INLINE -static void expand_error(f, e, maxlen) -char *f; -char *e; +INLINE static void +expand_error(char *f, char *e, int maxlen) { #ifndef HAS_STRERROR extern int sys_nerr; @@ -220,11 +215,11 @@ char *e; /* * Output the time of day and hostname to the logfile */ -static void show_time_host_and_name(lvl) -int lvl; +static void +show_time_host_and_name(int lvl) { -static time_t last_t = 0; -static char *last_ctime = 0; + static time_t last_t = 0; + static char *last_ctime = 0; time_t t = clocktime(); char *sev; extern char *ctime(); @@ -260,25 +255,16 @@ extern char **gargv; sev); } -#ifdef DEBUG -/*VARARGS1*/ -void dplog(fmt, j,s,_,p,e,n,d,r,y) -char *fmt; -char *j, *s, *_, *p, *e, *n, *d, *r, *y; -{ - plog(XLOG_DEBUG, fmt, j,s,_,p,e,n,d,r,y); -} - -#endif /* DEBUG */ /*VARARGS1*/ -void plog(lvl, fmt, j,s,_,p,e,n,d,r,y) -int lvl; -char *fmt; -char *j, *s, *_, *p, *e, *n, *d, *r, *y; +void +plog(int lvl, char *fmt, ...) { char msg[1024]; char efmt[1024]; char *ptr; + va_list ap; + + va_start(ap, fmt); if (!(xlog_level & lvl)) return; @@ -293,7 +279,7 @@ char *j, *s, *_, *p, *e, *n, *d, *r, *y; * more than 1024 bytes, if efmt is already large, and vargs expand * as well. */ - snprintf(msg, sizeof(msg), efmt, j,s,_,p,e,n,d,r,y); + vsnprintf(msg, sizeof(msg), efmt, ap); ptr = msg + strlen(msg); if (ptr[-1] == '\n') *--ptr = '\0'; @@ -318,22 +304,22 @@ char *j, *s, *_, *p, *e, *n, *d, *r, *y; /* * Mimic syslog header */ + va_end(ap); show_time_host_and_name(lvl); fwrite(msg, ptr - msg, 1, logfp); fputc('\n', logfp); fflush(logfp); } -void show_opts P((int ch, struct opt_tab *opts)); -void show_opts(ch, opts) -int ch; -struct opt_tab *opts; +void +show_opts(int ch, struct opt_tab *opts) { /* * Display current debug options */ int i; int s = '{'; + fprintf(stderr, "\t[-%c {no}", ch); for (i = 0; opts[i].opt; i++) { fprintf(stderr, "%c%s", s, opts[i].opt); @@ -342,11 +328,8 @@ struct opt_tab *opts; fputs("}]\n", stderr); } -int cmdoption P((char *s, struct opt_tab *optb, int *flags)); -int cmdoption(s, optb, flags) -char *s; -struct opt_tab *optb; -int *flags; +int +cmdoption(char *s, struct opt_tab *optb, int *flags) { char *p = s; int errs = 0; @@ -412,8 +395,8 @@ int *flags; /* * Switch on/off logging options */ -int switch_option(opt) -char *opt; +int +switch_option(char *opt) { int xl = xlog_level; int rc = cmdoption(opt, xlog_opt, &xl); @@ -436,9 +419,8 @@ char *opt; /* * Change current logfile */ -int switch_to_logfile P((char *logfile)); -int switch_to_logfile(logfile) -char *logfile; +int +switch_to_logfile(char *logfile) { FILE *new_logfp = stderr; @@ -488,7 +470,8 @@ char *logfile; time_t clock_valid = 0; time_t xclock_valid = 0; #ifndef clocktime -time_t clocktime(P_void) +time_t +clocktime(P_void) { time_t now = time(&clock_valid); if (xclock_valid > now) { diff --git a/usr.sbin/amd/amq/amq.c b/usr.sbin/amd/amq/amq.c index c4f4989c98a..c4cb3041ece 100644 --- a/usr.sbin/amd/amq/amq.c +++ b/usr.sbin/amd/amq/amq.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq.c 8.1 (Berkeley) 6/7/93 - * $Id: amq.c,v 1.5 1997/01/15 23:43:46 millert Exp $ + * $Id: amq.c,v 1.6 2002/08/03 08:29:32 pvalchev Exp $ */ /* @@ -52,7 +52,7 @@ char copyright[] = "\ #endif /* not lint */ #ifndef lint -static char rcsid[] = "$Id: amq.c,v 1.5 1997/01/15 23:43:46 millert Exp $"; +static char rcsid[] = "$Id: amq.c,v 1.6 2002/08/03 08:29:32 pvalchev Exp $"; static char sccsid[] = "@(#)amq.c 8.1 (Berkeley) 6/7/93"; #endif /* not lint */ @@ -61,10 +61,10 @@ static char sccsid[] = "@(#)amq.c 8.1 (Berkeley) 6/7/93"; #include <stdio.h> #include <fcntl.h> #include <netdb.h> +#include <unistd.h> static int privsock(); -char *progname; static int flush_flag; static int minfo_flag; static int unmount_flag; @@ -89,12 +89,9 @@ enum show_opt { Full, Stats, Calc, Short, ShowDone }; * If (e) is Calc then just calculate the sizes * Otherwise display the mount node on stdout */ -static void show_mti(mt, e, mwid, dwid, twid) -amq_mount_tree *mt; -enum show_opt e; -int *mwid; -int *dwid; -int *twid; +static void +show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, + int *twid) { switch (e) { case Calc: { @@ -163,12 +160,9 @@ printf("%-*.*s %-5d %-7d %-6d %-7d %-7d %-6d %02d/%02d/%02d %02d:%02d:%02d\n", /* * Display a mount tree. */ -static void show_mt(mt, e, mwid, dwid, pwid) -amq_mount_tree *mt; -enum show_opt e; -int *mwid; -int *dwid; -int *pwid; +static void +show_mt(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, + int *pwid) { while (mt) { show_mti(mt, e, mwid, dwid, pwid); @@ -177,14 +171,12 @@ int *pwid; } } -static void show_mi(ml, e, mwid, dwid, twid) -amq_mount_info_list *ml; -enum show_opt e; -int *mwid; -int *dwid; -int *twid; +static void +show_mi(amq_mount_info_list *ml, enum show_opt e, int *mwid, + int *dwid, int *twid) { int i; + switch (e) { case Calc: { for (i = 0; i < ml->amq_mount_info_list_len; i++) { @@ -231,8 +223,8 @@ int *twid; /* * Display general mount statistics */ -static void show_ms(ms) -amq_mount_stats *ms; +static void +show_ms(amq_mount_stats *ms) { printf("\ requests stale mount mount unmount\n\ @@ -242,9 +234,7 @@ deferred fhandles ok failed failed\n\ } static bool_t -xdr_pri_free(xdr_args, args_ptr) -xdrproc_t xdr_args; -caddr_t args_ptr; +xdr_pri_free(xdrproc_t xdr_args, caddr_t args_ptr) { XDR xdr; xdr.x_op = XDR_FREE; @@ -253,7 +243,8 @@ caddr_t args_ptr; #ifdef hpux #include <cluster.h> -static char *cluster_server() +static char * +cluster_server() { struct cct_entry *cp; @@ -276,9 +267,8 @@ static char *cluster_server() /* * MAIN */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char *argv[]) { int opt_ch; int errs = 0; @@ -293,76 +283,63 @@ char *argv[]; int nodefault = 0; /* - * Compute program name - */ - if (argv[0]) { - progname = strrchr(argv[0], '/'); - if (progname && progname[1]) - progname++; - else - progname = argv[0]; - } - if (!progname) - progname = "amq"; - - /* * Parse arguments */ while ((opt_ch = getopt(argc, argv, "fh:l:msuvx:D:M:")) != -1) - switch (opt_ch) { - case 'f': - flush_flag = 1; - nodefault = 1; - break; - - case 'h': - def_server = optarg; - break; - - case 'l': - logfile = optarg; - nodefault = 1; - break; - - case 'm': - minfo_flag = 1; - nodefault = 1; - break; - - case 's': - stats_flag = 1; - nodefault = 1; - break; - - case 'u': - unmount_flag = 1; - nodefault = 1; - break; - - case 'v': - getvers_flag = 1; - nodefault = 1; - break; - - case 'x': - xlog_optstr = optarg; - nodefault = 1; - break; - - case 'D': - debug_opts = optarg; - nodefault = 1; - break; - - case 'M': - mount_map = optarg; - nodefault = 1; - break; - - default: - errs = 1; - break; - } + switch (opt_ch) { + case 'f': + flush_flag = 1; + nodefault = 1; + break; + + case 'h': + def_server = optarg; + break; + + case 'l': + logfile = optarg; + nodefault = 1; + break; + + case 'm': + minfo_flag = 1; + nodefault = 1; + break; + + case 's': + stats_flag = 1; + nodefault = 1; + break; + + case 'u': + unmount_flag = 1; + nodefault = 1; + break; + + case 'v': + getvers_flag = 1; + nodefault = 1; + break; + + case 'x': + xlog_optstr = optarg; + nodefault = 1; + break; + + case 'D': + debug_opts = optarg; + nodefault = 1; + break; + + case 'M': + mount_map = optarg; + nodefault = 1; + break; + + default: + errs = 1; + break; + } if (optind == argc) { if (unmount_flag) @@ -373,7 +350,7 @@ char *argv[]; show_usage: fprintf(stderr, "\ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ -\t[-l logfile|\"syslog\"] [-x log_flags] [-D dbg_opts] [-M mapent]\n", progname); +\t[-l logfile|\"syslog\"] [-x log_flags] [-D dbg_opts] [-M mapent]\n", __progname); exit(1); } @@ -391,7 +368,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ * Get address of server */ if ((hp = gethostbyname(server)) == 0 && strcmp(server, localhost) != 0) { - fprintf(stderr, "%s: Can't get address of %s\n", progname, server); + fprintf(stderr, "%s: Can't get address of %s\n", __progname, server); exit(1); } bzero(&server_addr, sizeof server_addr); @@ -415,7 +392,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ clnt = clntudp_create(&server_addr, AMQ_PROGRAM, AMQ_VERSION, TIMEOUT, &s); } if (clnt == 0) { - fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s: ", __progname); clnt_pcreateerror(server); exit(1); } @@ -430,10 +407,10 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ opt.as_str = debug_opts; rc = amqproc_setopt_1(&opt, clnt); if (rc && *rc < 0) { - fprintf(stderr, "%s: daemon not compiled for debug", progname); + fprintf(stderr, "%s: daemon not compiled for debug", __progname); errs = 1; } else if (!rc || *rc > 0) { - fprintf(stderr, "%s: debug setting for \"%s\" failed\n", progname, debug_opts); + fprintf(stderr, "%s: debug setting for \"%s\" failed\n", __progname, debug_opts); errs = 1; } } @@ -448,7 +425,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ opt.as_str = xlog_optstr; rc = amqproc_setopt_1(&opt, clnt); if (!rc || *rc) { - fprintf(stderr, "%s: setting log level to \"%s\" failed\n", progname, xlog_optstr); + fprintf(stderr, "%s: setting log level to \"%s\" failed\n", __progname, xlog_optstr); errs = 1; } } @@ -463,7 +440,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ opt.as_str = logfile; rc = amqproc_setopt_1(&opt, clnt); if (!rc || *rc) { - fprintf(stderr, "%s: setting logfile to \"%s\" failed\n", progname, logfile); + fprintf(stderr, "%s: setting logfile to \"%s\" failed\n", __progname, logfile); errs = 1; } } @@ -478,7 +455,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ opt.as_str = ""; rc = amqproc_setopt_1(&opt, clnt); if (!rc || *rc) { - fprintf(stderr, "%s: amd on %s cannot flush the map cache\n", progname, server); + fprintf(stderr, "%s: amd on %s cannot flush the map cache\n", __progname, server); errs = 1; } } @@ -496,7 +473,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ show_mi(ml, Full, &mwid, &dwid, &twid); } else { - fprintf(stderr, "%s: amd on %s cannot provide mount info\n", progname, server); + fprintf(stderr, "%s: amd on %s cannot provide mount info\n", __progname, server); } } @@ -513,7 +490,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ errno = *rc; else errno = ETIMEDOUT; - fprintf(stderr, "%s: could not start new ", progname); + fprintf(stderr, "%s: could not start new ", __progname); perror("autmount point"); } } @@ -527,7 +504,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ printf("%s.\n", *spp); free(*spp); } else { - fprintf(stderr, "%s: failed to get version information\n", progname); + fprintf(stderr, "%s: failed to get version information\n", __progname); errs = 1; } } @@ -558,11 +535,11 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ dwid, dwid, "What"); show_mt(mt, Stats, &mwid, &dwid, &twid); } else { - fprintf(stderr, "%s: %s not automounted\n", progname, fs); + fprintf(stderr, "%s: %s not automounted\n", __progname, fs); } xdr_pri_free(xdr_amq_mount_tree_p, (caddr_t) mtp); } else { - fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s: ", __progname); clnt_perror(clnt, server); errs = 1; } @@ -575,7 +552,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ if (ms) { show_ms(ms); } else { - fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s: ", __progname); clnt_perror(clnt, server); errs = 1; } @@ -595,7 +572,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ else if (e == Short) e = ShowDone; } } else { - fprintf(stderr, "%s: ", progname); + fprintf(stderr, "%s: ", __progname); clnt_perror(clnt, server); errs = 1; } diff --git a/usr.sbin/amd/fsinfo/fsinfo.h b/usr.sbin/amd/fsinfo/fsinfo.h index 3cdd1758246..ac6eb7cfa8c 100644 --- a/usr.sbin/amd/fsinfo/fsinfo.h +++ b/usr.sbin/amd/fsinfo/fsinfo.h @@ -36,18 +36,16 @@ * SUCH DAMAGE. * * from: @(#)fsinfo.h 8.1 (Berkeley) 6/6/93 - * $Id: fsinfo.h,v 1.3 2001/01/02 20:01:35 mickey Exp $ + * $Id: fsinfo.h,v 1.4 2002/08/03 08:29:32 pvalchev Exp $ */ /* * Get this in now so that OS_HDR can use it */ #ifdef __STDC__ -#define P(x) x #define P_void void #define Const const #else -#define P(x) () #define P_void /* as nothing */ #define Const /* as nothing */ #endif /* __STDC__ */ @@ -124,7 +122,6 @@ extern char *fsmount_strings[]; extern char *host_strings[]; extern char *ether_if_strings[]; extern char *autodir; -extern char *__progname; extern char hostname[]; extern char *username; extern char **g_argv; diff --git a/usr.sbin/amd/include/am.h b/usr.sbin/amd/include/am.h index f5588ff1867..c6ab605ae9a 100644 --- a/usr.sbin/amd/include/am.h +++ b/usr.sbin/amd/include/am.h @@ -1,4 +1,4 @@ -/* $OpenBSD: am.h,v 1.6 2002/07/18 00:58:58 pvalchev Exp $ */ +/* $OpenBSD: am.h,v 1.7 2002/08/03 08:29:32 pvalchev Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -175,10 +175,10 @@ extern char *wire; /* Name of primary connected network */ #define NEXP_AP (254) #define NEXP_AP_MARGIN (128) -typedef int (*task_fun)P((voidp)); -typedef void (*cb_fun)P((int, int, voidp)); -typedef void (*fwd_fun)P((voidp, int, struct sockaddr_in *, - struct sockaddr_in *, voidp, int)); +typedef int (*task_fun)(voidp); +typedef void (*cb_fun)(int, int, voidp); +typedef void (*fwd_fun)(voidp, int, struct sockaddr_in *, + struct sockaddr_in *, voidp, int); /* * String comparison macros @@ -216,6 +216,8 @@ struct mntlist { */ typedef struct mnt_map mnt_map; +struct fhstatus; + /* * Global routines */ @@ -229,6 +231,7 @@ extern int softclock(P_void); extern int debug_option(char *); #endif /* DEBUG */ extern void deslashify(char *); +extern void discard_mntlist(mntlist *mp); /*extern void domain_strip(char*, char *);*/ extern mntfs *dup_mntfs(mntfs *); extern fserver *dup_srvr(fserver*); @@ -241,6 +244,7 @@ extern mntfs *find_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *); extern void flush_mntfs(P_void); extern void flush_nfs_fhandle_cache(fserver *); +extern void flush_srvr_nfs_cache(void); extern void forcibly_timeout_mp(am_node *); extern void free_mntfs(mntfs *); extern void free_opts(am_opts *); @@ -275,6 +279,7 @@ extern int mapc_keyiter(mnt_map*, void (*)(char *,voidp), voidp); extern int mapc_search(mnt_map *, char *, char **); extern void mapc_reload(P_void); extern void mapc_showtypes(FILE *); +extern void mf_mounted(mntfs *mf); extern int mkdirs(char *, int); extern void mk_fattr(am_node *, int); extern void mnt_free(struct mntent *); @@ -282,7 +287,7 @@ extern int mount_auto_node(char *, voidp); extern int mount_automounter(pid_t); extern int mount_exported(P_void); extern int mount_fs(struct mntent *, int, caddr_t, int, MTYPE_TYPE); -/*extern int mount_nfs_fh(struct fhstatus *, char *, char *, char *, mntfs *);*/ +extern int mount_nfs_fh(struct fhstatus *, char *, char *, char *, mntfs *); extern int mount_node(am_node *); extern mntfs *new_mntfs(P_void); extern void new_ttl(am_node *); @@ -321,8 +326,8 @@ extern int timeout(unsigned int, void (*fn)(), voidp); extern void timeout_mp(P_void); extern void umount_exported(P_void); extern int umount_fs(char *); -/*extern int unmount_node P((am_node*)); -extern int unmount_node_wrap P((voidp));*/ +/*extern int unmount_node(am_node*); +extern int unmount_node_wrap(voidp);*/ extern void unregister_amq(P_void); extern void untimeout(int); extern int valid_key(char *); @@ -380,27 +385,27 @@ struct am_fh { int fhh_gen; /* generation number */ }; -extern am_node *fh_to_mp P((nfs_fh*)); -extern am_node *fh_to_mp3 P((nfs_fh*,int*,int)); -extern void mp_to_fh P((am_node*, nfs_fh*)); +extern am_node *fh_to_mp(nfs_fh *); +extern am_node *fh_to_mp3(nfs_fh *, int *, int); +extern void mp_to_fh(am_node *, nfs_fh *); #define fh_to_mp2(fhp, rp) fh_to_mp3(fhp, rp, VLOOK_CREATE) -extern int auto_fmount P((am_node *mp)); -extern int auto_fumount P((am_node *mp)); +extern int auto_fmount(am_node *mp); +extern int auto_fumount(am_node *mp); #define MAX_READDIR_ENTRIES 16 -typedef char* (*vfs_match)P((am_opts*)); -typedef int (*vfs_init)P((mntfs*)); -typedef int (*vmount_fs)P((am_node*)); -typedef int (*vfmount_fs)P((mntfs*)); -typedef int (*vumount_fs)P((am_node*)); -typedef int (*vfumount_fs)P((mntfs*)); -typedef am_node*(*vlookuppn)P((am_node*, char*, int*, int)); -typedef int (*vreaddir)P((am_node*, nfscookie, dirlist*, entry*, int)); -typedef am_node*(*vreadlink)P((am_node*, int*)); -typedef void (*vmounted)P((mntfs*)); -typedef void (*vumounted)P((am_node*)); -typedef fserver*(*vffserver)P((mntfs*)); +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 (*vreaddir)(am_node *, nfscookie, dirlist *, entry *, int); +typedef am_node *(*vreadlink)(am_node *, int *); +typedef void (*vmounted)(mntfs *); +typedef void (*vumounted)(am_node *); +typedef fserver *(*vffserver)(mntfs *); struct am_ops { char *fs_type; @@ -418,8 +423,8 @@ struct am_ops { vffserver ffserver; int fs_flags; }; -extern am_node *efs_lookuppn P((am_node*, char*, int*, int)); -extern int efs_readdir P((am_node*, nfscookie, dirlist*, entry*, int)); +extern am_node *efs_lookuppn(am_node *, char *, int *, int); +extern int efs_readdir(am_node *, nfscookie, dirlist *, entry *, int); #define VLOOK_CREATE 0x1 #define VLOOK_DELETE 0x2 diff --git a/usr.sbin/amd/include/config.h b/usr.sbin/amd/include/config.h index 94dae3c9147..7ae834f2731 100644 --- a/usr.sbin/amd/include/config.h +++ b/usr.sbin/amd/include/config.h @@ -36,18 +36,16 @@ * SUCH DAMAGE. * * from: @(#)config.h 8.1 (Berkeley) 6/6/93 - * $Id: config.h,v 1.2 2002/05/26 02:49:50 deraadt Exp $ + * $Id: config.h,v 1.3 2002/08/03 08:29:32 pvalchev Exp $ */ /* * Get this in now so that OS_HDR can use it */ #ifdef __STDC__ -#define P(x) x #define P_void void #define Const const #else -#define P(x) () #define P_void /* as nothing */ #define Const /* as nothing */ #endif /* __STDC__ */ @@ -77,10 +75,9 @@ extern int errno; #include <sys/time.h> #define clocktime() (clock_valid ? clock_valid : time(&clock_valid)) -extern time_t time P((time_t *)); extern time_t clock_valid; /* Clock needs recalculating */ -extern char *progname; /* "amd"|"mmd" */ +extern char *__progname; extern char hostname[]; /* "kiska" */ extern pid_t mypid; /* Current process id */ @@ -126,15 +123,12 @@ struct opt_tab { extern struct opt_tab xlog_opt[]; -extern int cmdoption P((char*, struct opt_tab*, int*)); -extern void going_down P((int)); +extern int cmdoption(char *, struct opt_tab *, int *); +extern void going_down(int); #ifdef DEBUG -extern void dplog (); -/*extern void dplog P((char*, ...));*/ +#define dplog(fmt, args...) plog(XLOG_DEBUG, fmt, ## args) #endif /* DEBUG */ -extern void plog (); -/*extern void plog P((int, char*, ...));*/ -extern void show_opts P((int ch, struct opt_tab*)); -extern char* strchr P((const char*, int)); /* C */ -extern voidp xmalloc P((int)); -extern voidp xrealloc P((voidp, int)); +extern void plog(int, char *, ...); +extern void show_opts(int ch, struct opt_tab *); +extern voidp xmalloc(int); +extern voidp xrealloc(voidp, int); diff --git a/usr.sbin/amd/include/fstype.h b/usr.sbin/amd/include/fstype.h index 3f28563ad61..0bc0c9ac503 100644 --- a/usr.sbin/amd/include/fstype.h +++ b/usr.sbin/amd/include/fstype.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)fstype.h 8.1 (Berkeley) 6/6/93 - * $Id: fstype.h,v 1.1 1995/10/18 08:47:21 deraadt Exp $ + * $Id: fstype.h,v 1.2 2002/08/03 08:29:32 pvalchev Exp $ * */ @@ -48,11 +48,11 @@ * Automount File System */ #define HAS_AFS -extern am_ops afs_ops; /* Automount file system (this!) */ -extern am_ops toplvl_ops; /* Top-level automount file system */ -extern am_ops root_ops; /* Root file system */ -extern qelem afs_srvr_list; -extern fserver *find_afs_srvr P((mntfs*)); +extern am_ops afs_ops; /* Automount file system (this!) */ +extern am_ops toplvl_ops; /* Top-level automount file system */ +extern am_ops root_ops; /* Root file system */ +extern qelem afs_srvr_list; +extern fserver *find_afs_srvr(mntfs *); /* * Direct Automount File System @@ -102,7 +102,7 @@ extern am_ops host_ops; /* NFS host */ extern char *host_helper; /* "/usr/local/etc/amd-host" */ #endif extern qelem nfs_srvr_list; -extern fserver *find_nfs_srvr P((mntfs*)); +extern fserver *find_nfs_srvr(mntfs *); /* * Program File System diff --git a/usr.sbin/amd/rpcx/amq_clnt.c b/usr.sbin/amd/rpcx/amq_clnt.c index 91c85022f08..2e20f642d30 100644 --- a/usr.sbin/amd/rpcx/amq_clnt.c +++ b/usr.sbin/amd/rpcx/amq_clnt.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq_clnt.c 8.1 (Berkeley) 6/6/93 - * $Id: amq_clnt.c,v 1.1 1995/10/18 08:47:22 deraadt Exp $ + * $Id: amq_clnt.c,v 1.2 2002/08/03 08:29:32 pvalchev Exp $ * */ @@ -46,9 +46,7 @@ static struct timeval TIMEOUT = { ALLOWED_MOUNT_TIME, 0 }; voidp -amqproc_null_1(argp, clnt) - voidp argp; - CLIENT *clnt; +amqproc_null_1(voidp argp, CLIENT *clnt) { static char res; @@ -61,9 +59,7 @@ amqproc_null_1(argp, clnt) amq_mount_tree_p * -amqproc_mnttree_1(argp, clnt) - amq_string *argp; - CLIENT *clnt; +amqproc_mnttree_1(amq_string *argp, CLIENT *clnt) { static amq_mount_tree_p res; @@ -76,9 +72,7 @@ amqproc_mnttree_1(argp, clnt) voidp -amqproc_umnt_1(argp, clnt) - amq_string *argp; - CLIENT *clnt; +amqproc_umnt_1(amq_string *argp, CLIENT *clnt) { static char res; @@ -91,9 +85,7 @@ amqproc_umnt_1(argp, clnt) amq_mount_stats * -amqproc_stats_1(argp, clnt) - voidp argp; - CLIENT *clnt; +amqproc_stats_1(voidp argp, CLIENT *clnt) { static amq_mount_stats res; @@ -106,9 +98,7 @@ amqproc_stats_1(argp, clnt) amq_mount_tree_list * -amqproc_export_1(argp, clnt) - voidp argp; - CLIENT *clnt; +amqproc_export_1(voidp argp, CLIENT *clnt) { static amq_mount_tree_list res; @@ -120,9 +110,7 @@ amqproc_export_1(argp, clnt) } int * -amqproc_setopt_1(argp, clnt) - amq_setopt *argp; - CLIENT *clnt; +amqproc_setopt_1(amq_setopt *argp, CLIENT *clnt) { static int res; @@ -135,9 +123,7 @@ amqproc_setopt_1(argp, clnt) amq_mount_info_list * -amqproc_getmntfs_1(argp, clnt) - voidp argp; - CLIENT *clnt; +amqproc_getmntfs_1(voidp argp, CLIENT *clnt) { static amq_mount_info_list res; @@ -150,9 +136,7 @@ amqproc_getmntfs_1(argp, clnt) int * -amqproc_mount_1(argp, clnt) - voidp argp; - CLIENT *clnt; +amqproc_mount_1(voidp argp, CLIENT *clnt) { static int res; @@ -165,9 +149,7 @@ amqproc_mount_1(argp, clnt) amq_string * -amqproc_getvers_1(argp, clnt) - voidp argp; - CLIENT *clnt; +amqproc_getvers_1(voidp argp, CLIENT *clnt) { static amq_string res; @@ -177,4 +159,3 @@ amqproc_getvers_1(argp, clnt) } return (&res); } - diff --git a/usr.sbin/amd/rpcx/amq_svc.c b/usr.sbin/amd/rpcx/amq_svc.c index e553a786dd6..d56c2e14c5d 100644 --- a/usr.sbin/amd/rpcx/amq_svc.c +++ b/usr.sbin/amd/rpcx/amq_svc.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq_svc.c 8.1 (Berkeley) 6/6/93 - * $Id: amq_svc.c,v 1.3 1995/12/18 16:48:57 deraadt Exp $ + * $Id: amq_svc.c,v 1.4 2002/08/03 08:29:32 pvalchev Exp $ * */ @@ -45,9 +45,7 @@ extern bool_t xdr_amq_mount_info_qelem(); void -amq_program_1(rqstp, transp) - struct svc_req *rqstp; - SVCXPRT *transp; +amq_program_1(struct svc_req *rqstp, SVCXPRT *transp) { union { amq_string amqproc_mnttree_1_arg; @@ -132,4 +130,3 @@ amq_program_1(rqstp, transp) going_down(1); } } - diff --git a/usr.sbin/amd/rpcx/amq_xdr.c b/usr.sbin/amd/rpcx/amq_xdr.c index 35c8fe424d9..572704657dc 100644 --- a/usr.sbin/amd/rpcx/amq_xdr.c +++ b/usr.sbin/amd/rpcx/amq_xdr.c @@ -36,18 +36,15 @@ * SUCH DAMAGE. * * from: @(#)amq_xdr.c 8.1 (Berkeley) 6/6/93 - * $Id: amq_xdr.c,v 1.2 1997/01/31 14:42:23 graichen Exp $ + * $Id: amq_xdr.c,v 1.3 2002/08/03 08:29:32 pvalchev Exp $ * */ #include "am.h" #include "amq.h" - bool_t -xdr_amq_string(xdrs, objp) - XDR *xdrs; - amq_string *objp; +xdr_amq_string(XDR *xdrs, amq_string *objp) { if (!xdr_string(xdrs, objp, AMQ_STRLEN)) { return (FALSE); @@ -55,13 +52,8 @@ xdr_amq_string(xdrs, objp) return (TRUE); } - - - bool_t -xdr_time_type(xdrs, objp) - XDR *xdrs; - time_type *objp; +xdr_time_type(XDR *xdrs, time_type *objp) { if (!xdr_int(xdrs, (int *) objp)) { return (FALSE); @@ -69,13 +61,8 @@ xdr_time_type(xdrs, objp) return (TRUE); } - - - bool_t -xdr_amq_mount_tree(xdrs, objp) - XDR *xdrs; - amq_mount_tree *objp; +xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp) { if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) { return (FALSE); @@ -119,13 +106,8 @@ xdr_amq_mount_tree(xdrs, objp) return (TRUE); } - - - bool_t -xdr_amq_mount_tree_p(xdrs, objp) - XDR *xdrs; - amq_mount_tree_p *objp; +xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp) { if (!xdr_pointer(xdrs, (char **)objp, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { return (FALSE); @@ -133,12 +115,8 @@ xdr_amq_mount_tree_p(xdrs, objp) return (TRUE); } - - bool_t -xdr_amq_mount_info(xdrs, objp) - XDR *xdrs; - amq_mount_info *objp; +xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp) { if (!xdr_amq_string(xdrs, &objp->mi_type)) { return (FALSE); @@ -164,12 +142,8 @@ xdr_amq_mount_info(xdrs, objp) return (TRUE); } - - bool_t -xdr_amq_mount_info_list(xdrs, objp) - XDR *xdrs; - amq_mount_info_list *objp; +xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp) { if (!xdr_array(xdrs, (char **)&objp->amq_mount_info_list_val, (u_int *)&objp->amq_mount_info_list_len, ~0, sizeof(amq_mount_info), xdr_amq_mount_info)) { return (FALSE); @@ -177,12 +151,8 @@ xdr_amq_mount_info_list(xdrs, objp) return (TRUE); } - - bool_t -xdr_amq_mount_tree_list(xdrs, objp) - XDR *xdrs; - amq_mount_tree_list *objp; +xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp) { if (!xdr_array(xdrs, (char **)&objp->amq_mount_tree_list_val, (u_int *)&objp->amq_mount_tree_list_len, ~0, sizeof(amq_mount_tree_p), xdr_amq_mount_tree_p)) { return (FALSE); @@ -190,13 +160,8 @@ xdr_amq_mount_tree_list(xdrs, objp) return (TRUE); } - - - bool_t -xdr_amq_mount_stats(xdrs, objp) - XDR *xdrs; - amq_mount_stats *objp; +xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp) { if (!xdr_int(xdrs, &objp->as_drops)) { return (FALSE); @@ -216,13 +181,8 @@ xdr_amq_mount_stats(xdrs, objp) return (TRUE); } - - - bool_t -xdr_amq_opt(xdrs, objp) - XDR *xdrs; - amq_opt *objp; +xdr_amq_opt(XDR *xdrs, amq_opt *objp) { if (!xdr_enum(xdrs, (enum_t *)objp)) { return (FALSE); @@ -230,13 +190,8 @@ xdr_amq_opt(xdrs, objp) return (TRUE); } - - - bool_t -xdr_amq_setopt(xdrs, objp) - XDR *xdrs; - amq_setopt *objp; +xdr_amq_setopt(XDR *xdrs, amq_setopt *objp) { if (!xdr_amq_opt(xdrs, &objp->as_opt)) { return (FALSE); @@ -246,5 +201,3 @@ xdr_amq_setopt(xdrs, objp) } return (TRUE); } - - diff --git a/usr.sbin/amd/rpcx/mount.h b/usr.sbin/amd/rpcx/mount.h index 7b133b0cfed..8f8d2b95c35 100644 --- a/usr.sbin/amd/rpcx/mount.h +++ b/usr.sbin/amd/rpcx/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.3 2002/07/18 02:03:00 deraadt Exp $ */ +/* $OpenBSD: mount.h,v 1.4 2002/08/03 08:29:32 pvalchev Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -130,4 +130,3 @@ extern voidp mountproc_umntall_1(); extern exports *mountproc_export_1(); #define MOUNTPROC_EXPORTALL ((u_long)6) extern exports *mountproc_exportall_1(); - diff --git a/usr.sbin/amd/rpcx/mount_xdr.c b/usr.sbin/amd/rpcx/mount_xdr.c index 1ad64c69916..32cc9b629bb 100644 --- a/usr.sbin/amd/rpcx/mount_xdr.c +++ b/usr.sbin/amd/rpcx/mount_xdr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_xdr.c,v 1.2 1996/03/25 15:54:57 niklas Exp $ */ +/* $OpenBSD: mount_xdr.c,v 1.3 2002/08/03 08:29:32 pvalchev Exp $ */ /* * Copyright (c) 1989 Jan-Simon Pendry @@ -46,9 +46,7 @@ #if NFS_PROTOCOL_VERSION < 3 bool_t -xdr_fhandle(xdrs, objp) - XDR *xdrs; - fhandle objp; +xdr_fhandle(XDR *xdrs, fhandle objp) { if (!xdr_opaque(xdrs, objp, FHSIZE)) { return (FALSE); @@ -57,9 +55,7 @@ xdr_fhandle(xdrs, objp) } bool_t -xdr_fhstatus(xdrs, objp) - XDR *xdrs; - fhstatus *objp; +xdr_fhstatus(XDR *xdrs, fhstatus *objp) { if (!xdr_u_int(xdrs, &objp->fhs_stat)) { return (FALSE); @@ -78,11 +74,9 @@ xdr_fhstatus(xdrs, objp) #include <nfs/rpcv2.h> int -xdr_fhstatus(xdrsp, objp) - XDR *xdrsp; - fhstatus *objp; +xdr_fhstatus(XDR *xdrsp, fhstatus *objp) { - register int i; + int i; long auth, authcnt, authfnd = 0; @@ -122,14 +116,8 @@ xdr_fhstatus(xdrsp, objp) } #endif - - - - bool_t -xdr_dirpath(xdrs, objp) - XDR *xdrs; - dirpath *objp; +xdr_dirpath(XDR *xdrs, dirpath *objp) { if (!xdr_string(xdrs, objp, MNTPATHLEN)) { return (FALSE); @@ -137,13 +125,8 @@ xdr_dirpath(xdrs, objp) return (TRUE); } - - - bool_t -xdr_name(xdrs, objp) - XDR *xdrs; - name *objp; +xdr_name(XDR *xdrs, name *objp) { if (!xdr_string(xdrs, objp, MNTNAMLEN)) { return (FALSE); @@ -151,13 +134,8 @@ xdr_name(xdrs, objp) return (TRUE); } - - - bool_t -xdr_mountlist(xdrs, objp) - XDR *xdrs; - mountlist *objp; +xdr_mountlist(XDR *xdrs, mountlist *objp) { if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct mountbody), xdr_mountbody)) { return (FALSE); @@ -165,12 +143,8 @@ xdr_mountlist(xdrs, objp) return (TRUE); } - - bool_t -xdr_mountbody(xdrs, objp) - XDR *xdrs; - mountbody *objp; +xdr_mountbody(XDR *xdrs, mountbody *objp) { if (!xdr_name(xdrs, &objp->ml_hostname)) { return (FALSE); @@ -184,13 +158,8 @@ xdr_mountbody(xdrs, objp) return (TRUE); } - - - bool_t -xdr_groups(xdrs, objp) - XDR *xdrs; - groups *objp; +xdr_groups(XDR *xdrs, groups *objp) { if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct groupnode), xdr_groupnode)) { return (FALSE); @@ -198,13 +167,8 @@ xdr_groups(xdrs, objp) return (TRUE); } - - - bool_t -xdr_groupnode(xdrs, objp) - XDR *xdrs; - groupnode *objp; +xdr_groupnode(XDR *xdrs, groupnode *objp) { if (!xdr_name(xdrs, &objp->gr_name)) { return (FALSE); @@ -215,13 +179,8 @@ xdr_groupnode(xdrs, objp) return (TRUE); } - - - bool_t -xdr_exports(xdrs, objp) - XDR *xdrs; - exports *objp; +xdr_exports(XDR *xdrs, exports *objp) { if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct exportnode), xdr_exportnode)) { return (FALSE); @@ -229,13 +188,8 @@ xdr_exports(xdrs, objp) return (TRUE); } - - - bool_t -xdr_exportnode(xdrs, objp) - XDR *xdrs; - exportnode *objp; +xdr_exportnode(XDR *xdrs, exportnode *objp) { if (!xdr_dirpath(xdrs, &objp->ex_dir)) { return (FALSE); @@ -248,5 +202,3 @@ xdr_exportnode(xdrs, objp) } return (TRUE); } - - |