From b1184dfe52647d2f5f2d0000b7b828ead25fe72a Mon Sep 17 00:00:00 2001 From: dfr Date: Fri, 18 Apr 1997 13:23:38 +0000 Subject: [PATCH] Generate mount*.[ch] and nfs_prot*.[ch] from the .x files. Delete bogus local versions of mount*.[ch] and nfs_prot*.[ch]. Use v3 protocol by default for NFS mounts. If v3 is not supported, v2 is used automatically. Add a new mount options for NFS, 'nfsv2' to allow the administrator to force the use of the older protocol. Document the new mount options and fix a couple of markup problems. --- usr.sbin/amd/amd/Makefile | 24 ++ usr.sbin/amd/amd/nfs_ops.c | 134 +++++-- usr.sbin/amd/config/os-bsd44.h | 3 +- usr.sbin/amd/doc/amdref.texinfo | 28 +- usr.sbin/amd/rpcx/amq_svc.c | 6 +- usr.sbin/amd/rpcx/mount.h | 124 ------ usr.sbin/amd/rpcx/mount_xdr.c | 206 ---------- usr.sbin/amd/rpcx/nfs_prot.h | 389 ------------------- usr.sbin/amd/rpcx/nfs_prot_svc.c | 198 ---------- usr.sbin/amd/rpcx/nfs_prot_xdr.c | 627 ------------------------------- 10 files changed, 146 insertions(+), 1593 deletions(-) delete mode 100644 usr.sbin/amd/rpcx/mount.h delete mode 100644 usr.sbin/amd/rpcx/mount_xdr.c delete mode 100644 usr.sbin/amd/rpcx/nfs_prot.h delete mode 100644 usr.sbin/amd/rpcx/nfs_prot_svc.c delete mode 100644 usr.sbin/amd/rpcx/nfs_prot_xdr.c diff --git a/usr.sbin/amd/amd/Makefile b/usr.sbin/amd/amd/Makefile index 0bb69379981e..fb68010513f3 100644 --- a/usr.sbin/amd/amd/Makefile +++ b/usr.sbin/amd/amd/Makefile @@ -14,6 +14,7 @@ SRCS= afs_ops.c am_ops.c clock.c util.c xutil.c \ amq_subr.c umount_fs.c host_ops.c nfsx_ops.c \ ufs_ops.c ifs_ops.c amd.c get_args.c restart.c wire.c OBJS+= vers.${PROG}.o +CFLAGS+=-I${.OBJDIR} CFLAGS+=-I${.CURDIR}/../rpcx CFLAGS+=-I${.CURDIR}/../config CFLAGS+=-I${.CURDIR}/../include @@ -23,10 +24,33 @@ CFLAGS+=-DOS_HDR=\"os-${OS}.h\" CFLAGS+=${CONFIG} CFLAGS+=-D_NEW_VFSCONF CLEANFILES+=vers.${PROG}.c vers.${PROG}.o version.amd +CLEANFILES+=mount.h mount_xdr.c nfs_prot.h nfs_prot_xdr.c nfs_prot_svc.c +RPCCOM = rpcgen +MOUNT_X= /usr/include/rpcsvc/mount.x +NFS_PROT_X= /usr/include/rpcsvc/nfs_prot.x vers.${PROG}.c: ${SRCS:.c=.o} @d=${.CURDIR}/ sh ${.CURDIR}/../config/newvers.sh ${PROG} ${MACHINE} ${OS} +afs_ops.o host_ops.o nfs_ops.o srvr_nfs.o: mount.h + +mount.h: ${MOUNT_X} + ${RPCCOM} -h -DWANT_NFS3 ${MOUNT_X} -o ${.TARGET} + +mount_xdr.c: mount.h ${MOUNT_X} + ${RPCCOM} -c -DWANT_NFS3 ${MOUNT_X} -o ${.TARGET} + +${OBJS}: nfs_prot.h + +nfs_prot.h: ${NFS_PROT_X} + ${RPCCOM} -h ${NFS_PROT_X} -o ${.TARGET} + +nfs_prot_xdr.c: ${NFS_PROT_X} + ${RPCCOM} -c ${NFS_PROT_X} -o ${.TARGET} + +nfs_prot_svc.c: ${NFS_PROT_X} + ${RPCCOM} -m ${NFS_PROT_X} -o ${.TARGET} + .PATH: ${.CURDIR}/../rpcx ${.CURDIR}/../config .include "Makefile.config" .include "../../Makefile.inc" diff --git a/usr.sbin/amd/amd/nfs_ops.c b/usr.sbin/amd/amd/nfs_ops.c index 0f9cef8067da..9fd81cfd74d1 100644 --- a/usr.sbin/amd/amd/nfs_ops.c +++ b/usr.sbin/amd/amd/nfs_ops.c @@ -35,7 +35,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: nfs_ops.c,v 1.6 1997/02/22 16:01:37 peter Exp $ */ #ifndef lint @@ -65,7 +65,10 @@ typedef nfs_fh fhandle_t; /* * Convert from nfsstat to UN*X error code */ -#define unx_error(e) ((int)(e)) +#define unx_error(e) ((e) < 10000 ? (int)(e) \ + : ((e) == MNT3ERR_NOTSUPP ? EOPNOTSUPP \ + : ((e) == MNT3ERR_SERVERFAULT ? EIO \ + : EINVAL))) /* * The NFS layer maintains a cache of file handles. @@ -90,6 +93,16 @@ typedef nfs_fh fhandle_t; * changes. If it does, then you have other * problems... */ +typedef struct mountres { + int mr_version; /* 1 or 3 */ + union { + struct fhstatus mru_fhstatus; /* mount v1 result */ + struct mountres3 mru_mountres3; /* mount v3 result */ + } mr_un; +} mountres; +#define mr_fhstatus mr_un.mru_fhstatus +#define mr_mountres3 mr_un.mru_mountres3 + typedef struct fh_cache fh_cache; struct fh_cache { qelem fh_q; /* List header */ @@ -97,7 +110,7 @@ struct fh_cache { int fh_error; /* Valid data? */ int fh_id; /* Unique id */ int fh_cid; /* Callout id */ - struct fhstatus fh_handle; /* Handle on filesystem */ + mountres fh_mountres; /* Result of mount rpc */ struct sockaddr_in fh_sin; /* Address of mountd */ fserver *fh_fs; /* Server holding filesystem */ char *fh_path; /* Filesystem on host */ @@ -116,7 +129,7 @@ static int fh_id = 0; extern qelem fh_head; qelem fh_head = { &fh_head, &fh_head }; -static int call_mountd P((fh_cache*, unsigned long, fwd_fun, voidp)); +static int call_mountd P((fh_cache*, unsigned long, unsigned long, fwd_fun, voidp)); AUTH *nfs_auth; @@ -165,10 +178,24 @@ int done; { fh_cache *fp = find_nfs_fhandle_cache(idv, done); if (fp) { - fp->fh_error = pickup_rpc_reply(pkt, len, (voidp) &fp->fh_handle, xdr_fhstatus); + if (fp->fh_mountres.mr_version == MOUNTVERS3) { + fp->fh_error = pickup_rpc_reply(pkt, len, (voidp) &fp->fh_mountres.mr_mountres3, xdr_mountres3); + if (fp->fh_error) { + /* + * Fall back to version 1 protocol. + */ +#ifdef DEBUG + dlog("mount version 3 refused, retrying with version 1"); +#endif + fp->fh_id = FHID_ALLOC(); + fp->fh_mountres.mr_version = MOUNTVERS; + call_mountd(fp, MOUNTPROC_MNT, MOUNTVERS, got_nfs_fh, fp->fh_wchan); + } + } else + fp->fh_error = pickup_rpc_reply(pkt, len, (voidp) &fp->fh_mountres.mr_fhstatus, xdr_fhstatus); if (!fp->fh_error) { #ifdef DEBUG - dlog("got filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path); + dlog("got filehandle for %s:%s, version=%d", fp->fh_fs->fs_host, fp->fh_path, fp->fh_mountres.mr_version); #endif /* DEBUG */ /* * Wakeup anything sleeping on this filehandle @@ -205,6 +232,9 @@ fh_cache *fp; dlog("Discarding filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path); #endif /* DEBUG */ free_srvr(fp->fh_fs); + if (fp->fh_mountres.mr_version == MOUNTVERS3 + && fp->fh_mountres.mr_mountres3.mountres3_u.mountinfo.fhandle.fhandle3_val) + free(fp->fh_mountres.mr_mountres3.mountres3_u.mountinfo.fhandle.fhandle3_val); free((voidp) fp->fh_path); free((voidp) fp); } @@ -212,11 +242,12 @@ fh_cache *fp; /* * Determine the file handle for a node */ -static int prime_nfs_fhandle_cache P((char *path, fserver *fs, struct fhstatus *fhbuf, voidp wchan)); -static int prime_nfs_fhandle_cache(path, fs, fhbuf, wchan) +static int prime_nfs_fhandle_cache P((char *path, fserver *fs, int forcev2, struct mountres *mrbuf, voidp wchan)); +static int prime_nfs_fhandle_cache(path, fs, forcev2, mrbuf, wchan) char *path; fserver *fs; -struct fhstatus *fhbuf; +int forcev2; +struct mountres *mrbuf; voidp wchan; { fh_cache *fp, *fp_save = 0; @@ -234,11 +265,14 @@ voidp wchan; if (fs == fp->fh_fs && strcmp(path, fp->fh_path) == 0) { switch (fp->fh_error) { case 0: - error = fp->fh_error = unx_error(fp->fh_handle.fhs_status); + if (fp->fh_mountres.mr_version == MOUNTVERS) + error = fp->fh_error = unx_error(fp->fh_mountres.mr_fhstatus.fhs_status); + else + error = fp->fh_error = unx_error(fp->fh_mountres.mr_mountres3.fhs_status); if (error == 0) { - if (fhbuf) - bcopy((voidp) &fp->fh_handle, (voidp) fhbuf, - sizeof(fp->fh_handle)); + if (mrbuf) + bcopy((voidp) &fp->fh_mountres, (voidp) mrbuf, + sizeof(fp->fh_mountres)); if (fp->fh_cid) untimeout(fp->fh_cid); fp->fh_cid = timeout(FH_TTL, discard_fh, (voidp) fp); @@ -308,6 +342,21 @@ voidp wchan; fp->fh_wchan = wchan; fp->fh_error = -1; fp->fh_cid = timeout(FH_TTL, discard_fh, (voidp) fp); + if (forcev2) { + /* + * Force an NFSv2 mount. + */ +#ifdef DEBUG + dlog("forcing v2 mount"); +#endif + fp->fh_mountres.mr_version = MOUNTVERS; + } else { + /* + * Attempt v3 first. + */ + fp->fh_mountres.mr_version = MOUNTVERS3; + fp->fh_mountres.mr_mountres3.mountres3_u.mountinfo.fhandle.fhandle3_val = NULL; + } /* * If the address has changed then don't try to re-use the @@ -320,7 +369,7 @@ voidp wchan; fp->fh_fs = dup_srvr(fs); fp->fh_path = strdup(path); - error = call_mountd(fp, MOUNTPROC_MNT, got_nfs_fh, wchan); + error = call_mountd(fp, MOUNTPROC_MNT, fp->fh_mountres.mr_version, got_nfs_fh, wchan); if (error) { /* * Local error - cache for a short period @@ -355,10 +404,11 @@ int make_nfs_auth P((void)) return 0; } -static int call_mountd P((fh_cache *fp, u_long proc, fwd_fun f, voidp wchan)); -static int call_mountd(fp, proc, f, wchan) +static int call_mountd P((fh_cache *fp, u_long proc, u_long version, fwd_fun f, voidp wchan)); +static int call_mountd(fp, proc, version, f, wchan) fh_cache *fp; u_long proc; +u_long version; fwd_fun f; voidp wchan; { @@ -381,7 +431,7 @@ voidp wchan; fp->fh_sin.sin_port = port; } - rpc_msg_init(&mnt_msg, MOUNTPROG, MOUNTVERS, (unsigned long) 0); + rpc_msg_init(&mnt_msg, MOUNTPROG, version, (unsigned long) 0); len = make_rpc_packet(iobuf, sizeof(iobuf), proc, &mnt_msg, (voidp) &fp->fh_path, xdr_nfspath, nfs_auth); @@ -439,6 +489,24 @@ am_opts *fo; return xmtab; } +static int forcev2(mf) +mntfs *mf; +{ + struct mntent mnt; + + mnt.mnt_dir = mf->mf_mount; + mnt.mnt_fsname = mf->mf_info; + mnt.mnt_type = MTAB_TYPE_NFS; + mnt.mnt_opts = mf->mf_mopts; + mnt.mnt_freq = 0; + mnt.mnt_passno = 0; + + if (hasmntopt(&mnt, "nfsv2") != NULL) + return TRUE; + else + return FALSE; +} + /* * Initialise am structure for nfs */ @@ -447,17 +515,17 @@ mntfs *mf; { if (!mf->mf_private) { int error; - struct fhstatus fhs; + struct mountres mr; char *colon = strchr(mf->mf_info, ':'); if (colon == 0) return ENOENT; - error = prime_nfs_fhandle_cache(colon+1, mf->mf_server, &fhs, (voidp) mf); + error = prime_nfs_fhandle_cache(colon+1, mf->mf_server, forcev2(mf), &mr, (voidp) mf); if (!error) { - mf->mf_private = (voidp) ALLOC(fhstatus); + mf->mf_private = (voidp) ALLOC(mountres); mf->mf_prfree = (void (*)()) free; - bcopy((voidp) &fhs, mf->mf_private, sizeof(fhs)); + bcopy((voidp) &mr, mf->mf_private, sizeof(mr)); } return error; } @@ -465,9 +533,9 @@ mntfs *mf; return 0; } -int mount_nfs_fh P((struct fhstatus *fhp, char *dir, char *fs_name, char *opts, mntfs *mf)); -int mount_nfs_fh(fhp, dir, fs_name, opts, mf) -struct fhstatus *fhp; +int mount_nfs_fh P((struct mountres *mrp, char *dir, char *fs_name, char *opts, mntfs *mf)); +int mount_nfs_fh(mrp, dir, fs_name, opts, mf) +struct mountres *mrp; char *dir; char *fs_name; char *opts; @@ -528,10 +596,14 @@ mntfs *mf; /* * set mount args */ - NFS_FH_DREF(nfs_args.fh, (NFS_FH_TYPE) fhp->fhstatus_u.fhs_fhandle); -#ifdef NFSv3 - nfs_args.fhsize = FHSIZE; -#endif + if (mrp->mr_version == MOUNTVERS) { + NFS_FH_DREF(nfs_args.fh, (NFS_FH_TYPE) mrp->mr_fhstatus.fhstatus_u.fhs_fhandle); + nfs_args.fhsize = FHSIZE; + } else { + NFS_FH_DREF(nfs_args.fh, (NFS_FH_TYPE) mrp->mr_mountres3.mountres3_u.mountinfo.fhandle.fhandle3_val); + nfs_args.fhsize = mrp->mr_mountres3.mountres3_u.mountinfo.fhandle.fhandle3_len; + nfs_args.flags |= NFSMNT_NFSV3; + } #ifdef ULTRIX_HACK nfs_args.optstr = mnt.mnt_opts; @@ -682,7 +754,7 @@ mntfs *mf; #ifdef DEBUG dlog("locating fhandle for %s", fs_name); #endif /* DEBUG */ - error = prime_nfs_fhandle_cache(colon+1, mf->mf_server, &fhs, (voidp) 0); + error = prime_nfs_fhandle_cache(colon+1, mf->mf_server, forcev2(mf), &fhs, (voidp) 0); if (error) return error; @@ -694,7 +766,7 @@ mntfs *mf; return EINVAL; } - return mount_nfs_fh((struct fhstatus *) mf->mf_private, dir, fs_name, opts, mf); + return mount_nfs_fh((struct mountres *) mf->mf_private, dir, fs_name, opts, mf); } static int nfs_fmount(mf) @@ -767,7 +839,7 @@ am_node *mp; f.fh_id = 0; f.fh_error = 0; (void) prime_nfs_fhandle_cache(colon+1, mf->mf_server, (struct fhstatus *) 0, (voidp) mf); - (void) call_mountd(&f, MOUNTPROC_UMNT, (fwd_fun) 0, (voidp) 0); + (void) call_mountd(&f, MOUNTPROC_UMNT, MOUNTVERS, (fwd_fun) 0, (voidp) 0); *colon = ':'; } #endif /* INFORM_MOUNTD */ diff --git a/usr.sbin/amd/config/os-bsd44.h b/usr.sbin/amd/config/os-bsd44.h index 2d610b529905..a0a2a76c7146 100644 --- a/usr.sbin/amd/config/os-bsd44.h +++ b/usr.sbin/amd/config/os-bsd44.h @@ -37,7 +37,7 @@ * * @(#)os-bsd44.h 8.2 (Berkeley) 5/10/95 * - * $Id: os-bsd44.h,v 1.8 1997/03/11 15:51:36 peter Exp $ + * $Id: os-bsd44.h,v 1.9 1997/03/12 08:29:44 peter Exp $ * * 4.4 BSD definitions for Amd (automounter) */ @@ -114,7 +114,6 @@ (dst).addrlen = sizeof(*src); \ (dst).sotype = SOCK_DGRAM; \ (dst).proto = 0; \ - (dst).fhsize = FHSIZE; \ (dst).wsize = NFS_WSIZE; \ (dst).rsize = NFS_RSIZE; \ (dst).readdirsize = NFS_READDIRSIZE; \ diff --git a/usr.sbin/amd/doc/amdref.texinfo b/usr.sbin/amd/doc/amdref.texinfo index 0fba8273c23a..c305e14fb2ad 100644 --- a/usr.sbin/amd/doc/amdref.texinfo +++ b/usr.sbin/amd/doc/amdref.texinfo @@ -37,7 +37,7 @@ @c @c @(#)amdref.texinfo 8.1 (Berkeley) 6/6/93 @c -@c $Id$ +@c $Id: amdref.texinfo,v 1.4 1997/02/22 16:03:12 peter Exp $ @c @setfilename amdref.info @c @setfilename /usr/local/emacs/info/amd @@ -1384,6 +1384,8 @@ Use NFS compression protocol. Use BSD directory group-id semantics. @item intr Allow keyboard interrupts on hard mounts. +@item nfsv2 +Use the version 2 NFS protocol in preference to version 3. @item noconn Don't make a connection on datagram transports. @item nocto @@ -3076,11 +3078,11 @@ host @{ The options that can be given as host attributes are shown below. @menu -* netif Option: FSinfo host netif: -* config Option: FSinfo host config: -* arch Option: FSinfo host arch: -* os Option: FSinfo host os: -* cluster Option: FSinfo host cluster: +* netif Option: FSinfo host netif +* config Option: FSinfo host config +* arch Option: FSinfo host arch +* os Option: FSinfo host os +* cluster Option: FSinfo host cluster @end menu @node FSinfo host netif, FSinfo host config, , FSinfo host attributes @@ -3275,13 +3277,13 @@ fs /dev/dsk/5s0 @{ @end example @menu -* fstype Option: FSinfo filesystems fstype: -* opts Option: FSinfo filesystems opts: -* passno Option: FSinfo filesystems passno: -* freq Option: FSinfo filesystems freq: -* mount Option: FSinfo filesystems mount: -* dumpset Option: FSinfo filesystems dumpset: -* log Option: FSinfo filesystems log: +* fstype Option: FSinfo filesystems fstype +* opts Option: FSinfo filesystems opts +* passno Option: FSinfo filesystems passno +* freq Option: FSinfo filesystems freq +* mount Option: FSinfo filesystems mount +* dumpset Option: FSinfo filesystems dumpset +* log Option: FSinfo filesystems log @end menu @node FSinfo filesystems fstype, FSinfo filesystems opts, , FSinfo filesystems diff --git a/usr.sbin/amd/rpcx/amq_svc.c b/usr.sbin/amd/rpcx/amq_svc.c index fb69ecde0e5c..568864495080 100644 --- a/usr.sbin/amd/rpcx/amq_svc.c +++ b/usr.sbin/amd/rpcx/amq_svc.c @@ -37,7 +37,7 @@ * * @(#)amq_svc.c 8.1 (Berkeley) 6/6/93 * - * $Id$ + * $Id: amq_svc.c,v 1.3 1997/02/22 16:04:03 peter Exp $ * */ @@ -120,7 +120,7 @@ amq_program_1(rqstp, transp) return; } bzero((char *)&argument, sizeof(argument)); - if (!svc_getargs(transp, xdr_argument, &argument)) { + if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { svcerr_decode(transp); return; } @@ -128,7 +128,7 @@ amq_program_1(rqstp, transp) if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { svcerr_systemerr(transp); } - if (!svc_freeargs(transp, xdr_argument, &argument)) { + if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { plog(XLOG_FATAL, "unable to free rpc arguments in amqprog_1"); going_down(1); } diff --git a/usr.sbin/amd/rpcx/mount.h b/usr.sbin/amd/rpcx/mount.h deleted file mode 100644 index a9d7f04074ad..000000000000 --- a/usr.sbin/amd/rpcx/mount.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jan-Simon Pendry at Imperial College, London. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mount.h 8.1 (Berkeley) 6/6/93 - * - * $Id$ - * - */ - -#define MNTPATHLEN 1024 -#define MNTNAMLEN 255 -#define FHSIZE 32 - -typedef char fhandle[FHSIZE]; -bool_t xdr_fhandle(); - - -struct fhstatus { - u_int fhs_status; - union { - fhandle fhs_fhandle; - } fhstatus_u; -}; -typedef struct fhstatus fhstatus; -bool_t xdr_fhstatus(); - - -typedef char *dirpath; -bool_t xdr_dirpath(); - - -typedef char *name; -bool_t xdr_name(); - - -typedef struct mountbody *mountlist; -bool_t xdr_mountlist(); - - -struct mountbody { - name ml_hostname; - dirpath ml_directory; - mountlist ml_next; -}; -typedef struct mountbody mountbody; -bool_t xdr_mountbody(); - - -typedef struct groupnode *groups; -bool_t xdr_groups(); - - -struct groupnode { - name gr_name; - groups gr_next; -}; -typedef struct groupnode groupnode; -bool_t xdr_groupnode(); - - -typedef struct exportnode *exports; -bool_t xdr_exports(); - - -struct exportnode { - dirpath ex_dir; - groups ex_groups; - exports ex_next; -}; -typedef struct exportnode exportnode; -bool_t xdr_exportnode(); - - -#define MOUNTPROG ((u_long)100005) -#define MOUNTVERS ((u_long)1) -#define MOUNTPROC_NULL ((u_long)0) -extern voidp mountproc_null_1(); -#define MOUNTPROC_MNT ((u_long)1) -extern fhstatus *mountproc_mnt_1(); -#define MOUNTPROC_DUMP ((u_long)2) -extern mountlist *mountproc_dump_1(); -#define MOUNTPROC_UMNT ((u_long)3) -extern voidp mountproc_umnt_1(); -#define MOUNTPROC_UMNTALL ((u_long)4) -extern voidp mountproc_umntall_1(); -#define MOUNTPROC_EXPORT ((u_long)5) -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 deleted file mode 100644 index 0ddc3b75c26b..000000000000 --- a/usr.sbin/amd/rpcx/mount_xdr.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 1989 Jan-Simon Pendry - * Copyright (c) 1989 Imperial College of Science, Technology & Medicine - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jan-Simon Pendry at Imperial College, London. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mount_xdr.c 8.1 (Berkeley) 6/6/93 - * - * $Id$ - * - */ - -#include "am.h" -#include "mount.h" - - -bool_t -xdr_fhandle(xdrs, objp) - XDR *xdrs; - fhandle objp; -{ - if (!xdr_opaque(xdrs, objp, FHSIZE)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_fhstatus(xdrs, objp) - XDR *xdrs; - fhstatus *objp; -{ - if (!xdr_u_int(xdrs, &objp->fhs_status)) { - return (FALSE); - } - switch (objp->fhs_status) { - case 0: - if (!xdr_fhandle(xdrs, objp->fhstatus_u.fhs_fhandle)) { - return (FALSE); - } - break; - } - return (TRUE); -} - - - - -bool_t -xdr_dirpath(xdrs, objp) - XDR *xdrs; - dirpath *objp; -{ - if (!xdr_string(xdrs, objp, MNTPATHLEN)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_name(xdrs, objp) - XDR *xdrs; - name *objp; -{ - if (!xdr_string(xdrs, objp, MNTNAMLEN)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_mountlist(xdrs, objp) - XDR *xdrs; - mountlist *objp; -{ - if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct mountbody), xdr_mountbody)) { - return (FALSE); - } - return (TRUE); -} - - - -bool_t -xdr_mountbody(xdrs, objp) - XDR *xdrs; - mountbody *objp; -{ - if (!xdr_name(xdrs, &objp->ml_hostname)) { - return (FALSE); - } - if (!xdr_dirpath(xdrs, &objp->ml_directory)) { - return (FALSE); - } - if (!xdr_mountlist(xdrs, &objp->ml_next)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_groups(xdrs, objp) - XDR *xdrs; - groups *objp; -{ - if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct groupnode), xdr_groupnode)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_groupnode(xdrs, objp) - XDR *xdrs; - groupnode *objp; -{ - if (!xdr_name(xdrs, &objp->gr_name)) { - return (FALSE); - } - if (!xdr_groups(xdrs, &objp->gr_next)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_exports(xdrs, objp) - XDR *xdrs; - exports *objp; -{ - if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct exportnode), xdr_exportnode)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_exportnode(xdrs, objp) - XDR *xdrs; - exportnode *objp; -{ - if (!xdr_dirpath(xdrs, &objp->ex_dir)) { - return (FALSE); - } - if (!xdr_groups(xdrs, &objp->ex_groups)) { - return (FALSE); - } - if (!xdr_exports(xdrs, &objp->ex_next)) { - return (FALSE); - } - return (TRUE); -} - - diff --git a/usr.sbin/amd/rpcx/nfs_prot.h b/usr.sbin/amd/rpcx/nfs_prot.h deleted file mode 100644 index 1fd1204ce914..000000000000 --- a/usr.sbin/amd/rpcx/nfs_prot.h +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) 1990 Jan-Simon Pendry - * Copyright (c) 1990 Imperial College of Science, Technology & Medicine - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jan-Simon Pendry at Imperial College, London. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfs_prot.h 8.1 (Berkeley) 6/6/93 - * - * $Id$ - * - */ - -#define xdr_nfsstat xdr_enum -#define xdr_ftype xdr_enum - -#define NFS_PORT 2049 -#define NFS_MAXDATA 8192 -#define NFS_MAXPATHLEN 1024 -#define NFS_MAXNAMLEN 255 -#define NFS_FHSIZE 32 -#define NFS_COOKIESIZE 4 -#define NFS_FIFO_DEV -1 -#define NFSMODE_FMT 0170000 -#define NFSMODE_DIR 0040000 -#define NFSMODE_CHR 0020000 -#define NFSMODE_BLK 0060000 -#define NFSMODE_REG 0100000 -#define NFSMODE_LNK 0120000 -#define NFSMODE_SOCK 0140000 -#define NFSMODE_FIFO 0010000 - -enum nfsstat { - NFS_OK = 0, - NFSERR_PERM = 1, - NFSERR_NOENT = 2, - NFSERR_IO = 5, - NFSERR_NXIO = 6, - NFSERR_ACCES = 13, - NFSERR_EXIST = 17, - NFSERR_NODEV = 19, - NFSERR_NOTDIR = 20, - NFSERR_ISDIR = 21, - NFSERR_FBIG = 27, - NFSERR_NOSPC = 28, - NFSERR_ROFS = 30, - NFSERR_NAMETOOLONG = 63, - NFSERR_NOTEMPTY = 66, - NFSERR_DQUOT = 69, - NFSERR_STALE = 70, - NFSERR_WFLUSH = 99 -}; -typedef enum nfsstat nfsstat; -bool_t xdr_nfsstat(); - - -enum ftype { - NFNON = 0, - NFREG = 1, - NFDIR = 2, - NFBLK = 3, - NFCHR = 4, - NFLNK = 5, - NFSOCK = 6, - NFBAD = 7, - NFFIFO = 8 -}; -typedef enum ftype ftype; -/* static bool_t xdr_ftype(); */ - - -struct nfs_fh { - char data[NFS_FHSIZE]; -}; -typedef struct nfs_fh nfs_fh; -bool_t xdr_nfs_fh(); - - -struct nfstime { - u_int seconds; - u_int useconds; -}; -typedef struct nfstime nfstime; -/* static bool_t xdr_nfstime(); */ - - -struct fattr { - ftype type; - u_int mode; - u_int nlink; - u_int uid; - u_int gid; - u_int size; - u_int blocksize; - u_int rdev; - u_int blocks; - u_int fsid; - u_int fileid; - nfstime atime; - nfstime mtime; - nfstime ctime; -}; -typedef struct fattr fattr; -/* static bool_t xdr_fattr(); */ - - -struct sattr { - u_int mode; - u_int uid; - u_int gid; - u_int size; - nfstime atime; - nfstime mtime; -}; -typedef struct sattr sattr; -/* static bool_t xdr_sattr(); */ - - -typedef char *filename; -/* static bool_t xdr_filename(); */ - - -typedef char *nfspath; -bool_t xdr_nfspath(); - - -struct attrstat { - nfsstat status; - union { - fattr attributes; - } attrstat_u; -}; -typedef struct attrstat attrstat; -bool_t xdr_attrstat(); - - -struct sattrargs { - nfs_fh file; - sattr attributes; -}; -typedef struct sattrargs sattrargs; -bool_t xdr_sattrargs(); - - -struct diropargs { - nfs_fh dir; - filename name; -}; -typedef struct diropargs diropargs; -bool_t xdr_diropargs(); - - -struct diropokres { - nfs_fh file; - fattr attributes; -}; -typedef struct diropokres diropokres; -bool_t xdr_diropokres(); - - -struct diropres { - nfsstat status; - union { - diropokres diropres; - } diropres_u; -}; -typedef struct diropres diropres; -bool_t xdr_diropres(); - - -struct readlinkres { - nfsstat status; - union { - nfspath data; - } readlinkres_u; -}; -typedef struct readlinkres readlinkres; -bool_t xdr_readlinkres(); - - -struct readargs { - nfs_fh file; - u_int offset; - u_int count; - u_int totalcount; -}; -typedef struct readargs readargs; -bool_t xdr_readargs(); - - -struct readokres { - fattr attributes; - struct { - u_int data_len; - char *data_val; - } data; -}; -typedef struct readokres readokres; -bool_t xdr_readokres(); - - -struct readres { - nfsstat status; - union { - readokres reply; - } readres_u; -}; -typedef struct readres readres; -bool_t xdr_readres(); - - -struct writeargs { - nfs_fh file; - u_int beginoffset; - u_int offset; - u_int totalcount; - struct { - u_int data_len; - char *data_val; - } data; -}; -typedef struct writeargs writeargs; -bool_t xdr_writeargs(); - - -struct createargs { - diropargs where; - sattr attributes; -}; -typedef struct createargs createargs; -bool_t xdr_createargs(); - - -struct renameargs { - diropargs from; - diropargs to; -}; -typedef struct renameargs renameargs; -bool_t xdr_renameargs(); - - -struct linkargs { - nfs_fh from; - diropargs to; -}; -typedef struct linkargs linkargs; -bool_t xdr_linkargs(); - - -struct symlinkargs { - diropargs from; - nfspath to; - sattr attributes; -}; -typedef struct symlinkargs symlinkargs; -bool_t xdr_symlinkargs(); - - -typedef char nfscookie[NFS_COOKIESIZE]; -/* static bool_t xdr_nfscookie(); */ - - -struct readdirargs { - nfs_fh dir; - nfscookie cookie; - u_int count; -}; -typedef struct readdirargs readdirargs; -bool_t xdr_readdirargs(); - - -struct entry { - u_int fileid; - filename name; - nfscookie cookie; - struct entry *nextentry; -}; -typedef struct entry entry; -/* static bool_t xdr_entry(); */ - - -struct dirlist { - entry *entries; - bool_t eof; -}; -typedef struct dirlist dirlist; -/* static bool_t xdr_dirlist(); */ - - -struct readdirres { - nfsstat status; - union { - dirlist reply; - } readdirres_u; -}; -typedef struct readdirres readdirres; -bool_t xdr_readdirres(); - - -struct statfsokres { - u_int tsize; - u_int bsize; - u_int blocks; - u_int bfree; - u_int bavail; -}; -typedef struct statfsokres statfsokres; -bool_t xdr_statfsokres(); - - -struct statfsres { - nfsstat status; - union { - statfsokres reply; - } statfsres_u; -}; -typedef struct statfsres statfsres; -bool_t xdr_statfsres(); - - -#define NFS_PROGRAM ((u_long)100003) -#define NFS_VERSION ((u_long)2) -#define NFSPROC_NULL ((u_long)0) -extern voidp nfsproc_null_2(); -#define NFSPROC_GETATTR ((u_long)1) -extern attrstat *nfsproc_getattr_2(); -#define NFSPROC_SETATTR ((u_long)2) -extern attrstat *nfsproc_setattr_2(); -#define NFSPROC_ROOT ((u_long)3) -extern voidp nfsproc_root_2(); -#define NFSPROC_LOOKUP ((u_long)4) -extern diropres *nfsproc_lookup_2(); -#define NFSPROC_READLINK ((u_long)5) -extern readlinkres *nfsproc_readlink_2(); -#define NFSPROC_READ ((u_long)6) -extern readres *nfsproc_read_2(); -#define NFSPROC_WRITECACHE ((u_long)7) -extern voidp nfsproc_writecache_2(); -#define NFSPROC_WRITE ((u_long)8) -extern attrstat *nfsproc_write_2(); -#define NFSPROC_CREATE ((u_long)9) -extern diropres *nfsproc_create_2(); -#define NFSPROC_REMOVE ((u_long)10) -extern nfsstat *nfsproc_remove_2(); -#define NFSPROC_RENAME ((u_long)11) -extern nfsstat *nfsproc_rename_2(); -#define NFSPROC_LINK ((u_long)12) -extern nfsstat *nfsproc_link_2(); -#define NFSPROC_SYMLINK ((u_long)13) -extern nfsstat *nfsproc_symlink_2(); -#define NFSPROC_MKDIR ((u_long)14) -extern diropres *nfsproc_mkdir_2(); -#define NFSPROC_RMDIR ((u_long)15) -extern nfsstat *nfsproc_rmdir_2(); -#define NFSPROC_READDIR ((u_long)16) -extern readdirres *nfsproc_readdir_2(); -#define NFSPROC_STATFS ((u_long)17) -extern statfsres *nfsproc_statfs_2(); - diff --git a/usr.sbin/amd/rpcx/nfs_prot_svc.c b/usr.sbin/amd/rpcx/nfs_prot_svc.c deleted file mode 100644 index 363d4dd059eb..000000000000 --- a/usr.sbin/amd/rpcx/nfs_prot_svc.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 1989 Jan-Simon Pendry - * Copyright (c) 1989 Imperial College of Science, Technology & Medicine - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jan-Simon Pendry at Imperial College, London. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfs_prot_svc.c 8.1 (Berkeley) 6/6/93 - * - * $Id$ - * - */ - -#include "am.h" - -void nfs_program_2(rqstp, transp) -struct svc_req *rqstp; -SVCXPRT *transp; -{ - union { - nfs_fh nfsproc_getattr_2_arg; - sattrargs nfsproc_setattr_2_arg; - diropargs nfsproc_lookup_2_arg; - nfs_fh nfsproc_readlink_2_arg; - readargs nfsproc_read_2_arg; - writeargs nfsproc_write_2_arg; - createargs nfsproc_create_2_arg; - diropargs nfsproc_remove_2_arg; - renameargs nfsproc_rename_2_arg; - linkargs nfsproc_link_2_arg; - symlinkargs nfsproc_symlink_2_arg; - createargs nfsproc_mkdir_2_arg; - diropargs nfsproc_rmdir_2_arg; - readdirargs nfsproc_readdir_2_arg; - nfs_fh nfsproc_statfs_2_arg; - } argument; - char *result; - bool_t (*xdr_argument)(), (*xdr_result)(); - char *(*local)(); - - switch (rqstp->rq_proc) { - case NFSPROC_NULL: - xdr_argument = xdr_void; - xdr_result = xdr_void; - local = (char *(*)()) nfsproc_null_2; - break; - - case NFSPROC_GETATTR: - xdr_argument = xdr_nfs_fh; - xdr_result = xdr_attrstat; - local = (char *(*)()) nfsproc_getattr_2; - break; - - case NFSPROC_SETATTR: - xdr_argument = xdr_sattrargs; - xdr_result = xdr_attrstat; - local = (char *(*)()) nfsproc_setattr_2; - break; - - case NFSPROC_ROOT: - xdr_argument = xdr_void; - xdr_result = xdr_void; - local = (char *(*)()) nfsproc_root_2; - break; - - case NFSPROC_LOOKUP: - xdr_argument = xdr_diropargs; - xdr_result = xdr_diropres; - local = (char *(*)()) nfsproc_lookup_2; - break; - - case NFSPROC_READLINK: - xdr_argument = xdr_nfs_fh; - xdr_result = xdr_readlinkres; - local = (char *(*)()) nfsproc_readlink_2; - break; - - case NFSPROC_READ: - xdr_argument = xdr_readargs; - xdr_result = xdr_readres; - local = (char *(*)()) nfsproc_read_2; - break; - - case NFSPROC_WRITECACHE: - xdr_argument = xdr_void; - xdr_result = xdr_void; - local = (char *(*)()) nfsproc_writecache_2; - break; - - case NFSPROC_WRITE: - xdr_argument = xdr_writeargs; - xdr_result = xdr_attrstat; - local = (char *(*)()) nfsproc_write_2; - break; - - case NFSPROC_CREATE: - xdr_argument = xdr_createargs; - xdr_result = xdr_diropres; - local = (char *(*)()) nfsproc_create_2; - break; - - case NFSPROC_REMOVE: - xdr_argument = xdr_diropargs; - xdr_result = xdr_nfsstat; - local = (char *(*)()) nfsproc_remove_2; - break; - - case NFSPROC_RENAME: - xdr_argument = xdr_renameargs; - xdr_result = xdr_nfsstat; - local = (char *(*)()) nfsproc_rename_2; - break; - - case NFSPROC_LINK: - xdr_argument = xdr_linkargs; - xdr_result = xdr_nfsstat; - local = (char *(*)()) nfsproc_link_2; - break; - - case NFSPROC_SYMLINK: - xdr_argument = xdr_symlinkargs; - xdr_result = xdr_nfsstat; - local = (char *(*)()) nfsproc_symlink_2; - break; - - case NFSPROC_MKDIR: - xdr_argument = xdr_createargs; - xdr_result = xdr_diropres; - local = (char *(*)()) nfsproc_mkdir_2; - break; - - case NFSPROC_RMDIR: - xdr_argument = xdr_diropargs; - xdr_result = xdr_nfsstat; - local = (char *(*)()) nfsproc_rmdir_2; - break; - - case NFSPROC_READDIR: - xdr_argument = xdr_readdirargs; - xdr_result = xdr_readdirres; - local = (char *(*)()) nfsproc_readdir_2; - break; - - case NFSPROC_STATFS: - xdr_argument = xdr_nfs_fh; - xdr_result = xdr_statfsres; - local = (char *(*)()) nfsproc_statfs_2; - break; - - default: - svcerr_noproc(transp); - return; - } - bzero((char *)&argument, sizeof(argument)); - if (!svc_getargs(transp, xdr_argument, &argument)) { - svcerr_decode(transp); - return; - } - result = (*local)(&argument, rqstp); - if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { - svcerr_systemerr(transp); - } - if (!svc_freeargs(transp, xdr_argument, &argument)) { - plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program_1"); - going_down(1); - } -} - diff --git a/usr.sbin/amd/rpcx/nfs_prot_xdr.c b/usr.sbin/amd/rpcx/nfs_prot_xdr.c deleted file mode 100644 index 06d13ddf80b1..000000000000 --- a/usr.sbin/amd/rpcx/nfs_prot_xdr.c +++ /dev/null @@ -1,627 +0,0 @@ -/* - * Copyright (c) 1989 Jan-Simon Pendry - * Copyright (c) 1989 Imperial College of Science, Technology & Medicine - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jan-Simon Pendry at Imperial College, London. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nfs_prot_xdr.c 8.1 (Berkeley) 6/6/93 - * - * $Id$ - * - */ - -#include "am.h" - - -#ifndef xdr_nfsstat -bool_t -xdr_nfsstat(xdrs, objp) - XDR *xdrs; - nfsstat *objp; -{ - if (!xdr_enum(xdrs, (enum_t *)objp)) { - return (FALSE); - } - return (TRUE); -} -#endif /* xdr_nfsstat */ - - - -#ifndef xdr_ftype -static bool_t -xdr_ftype(xdrs, objp) - XDR *xdrs; - ftype *objp; -{ - if (!xdr_enum(xdrs, (enum_t *)objp)) { - return (FALSE); - } - return (TRUE); -} -#endif /* xdr_ftype */ - - - -bool_t -xdr_nfs_fh(xdrs, objp) - XDR *xdrs; - nfs_fh *objp; -{ - if (!xdr_opaque(xdrs, objp->data, NFS_FHSIZE)) { - return (FALSE); - } - return (TRUE); -} - - - - -static bool_t -xdr_nfstime(xdrs, objp) - XDR *xdrs; - nfstime *objp; -{ - if (!xdr_u_int(xdrs, &objp->seconds)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->useconds)) { - return (FALSE); - } - return (TRUE); -} - - - - -static bool_t -xdr_fattr(xdrs, objp) - XDR *xdrs; - fattr *objp; -{ - if (!xdr_ftype(xdrs, &objp->type)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->mode)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->nlink)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->uid)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->gid)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->size)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->blocksize)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->rdev)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->blocks)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->fsid)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->fileid)) { - return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->atime)) { - return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->mtime)) { - return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->ctime)) { - return (FALSE); - } - return (TRUE); -} - - - - -static bool_t -xdr_sattr(xdrs, objp) - XDR *xdrs; - sattr *objp; -{ - if (!xdr_u_int(xdrs, &objp->mode)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->uid)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->gid)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->size)) { - return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->atime)) { - return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->mtime)) { - return (FALSE); - } - return (TRUE); -} - - - - -static bool_t -xdr_filename(xdrs, objp) - XDR *xdrs; - filename *objp; -{ - if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_nfspath(xdrs, objp) - XDR *xdrs; - nfspath *objp; -{ - if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_attrstat(xdrs, objp) - XDR *xdrs; - attrstat *objp; -{ - if (!xdr_nfsstat(xdrs, &objp->status)) { - return (FALSE); - } - switch (objp->status) { - case NFS_OK: - if (!xdr_fattr(xdrs, &objp->attrstat_u.attributes)) { - return (FALSE); - } - break; - } - return (TRUE); -} - - - - -bool_t -xdr_sattrargs(xdrs, objp) - XDR *xdrs; - sattrargs *objp; -{ - if (!xdr_nfs_fh(xdrs, &objp->file)) { - return (FALSE); - } - if (!xdr_sattr(xdrs, &objp->attributes)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_diropargs(xdrs, objp) - XDR *xdrs; - diropargs *objp; -{ - if (!xdr_nfs_fh(xdrs, &objp->dir)) { - return (FALSE); - } - if (!xdr_filename(xdrs, &objp->name)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_diropokres(xdrs, objp) - XDR *xdrs; - diropokres *objp; -{ - if (!xdr_nfs_fh(xdrs, &objp->file)) { - return (FALSE); - } - if (!xdr_fattr(xdrs, &objp->attributes)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_diropres(xdrs, objp) - XDR *xdrs; - diropres *objp; -{ - if (!xdr_nfsstat(xdrs, &objp->status)) { - return (FALSE); - } - switch (objp->status) { - case NFS_OK: - if (!xdr_diropokres(xdrs, &objp->diropres_u.diropres)) { - return (FALSE); - } - break; - } - return (TRUE); -} - - - - -bool_t -xdr_readlinkres(xdrs, objp) - XDR *xdrs; - readlinkres *objp; -{ - if (!xdr_nfsstat(xdrs, &objp->status)) { - return (FALSE); - } - switch (objp->status) { - case NFS_OK: - if (!xdr_nfspath(xdrs, &objp->readlinkres_u.data)) { - return (FALSE); - } - break; - } - return (TRUE); -} - - - - -bool_t -xdr_readargs(xdrs, objp) - XDR *xdrs; - readargs *objp; -{ - if (!xdr_nfs_fh(xdrs, &objp->file)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->offset)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->count)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->totalcount)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_readokres(xdrs, objp) - XDR *xdrs; - readokres *objp; -{ - if (!xdr_fattr(xdrs, &objp->attributes)) { - return (FALSE); - } - if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, NFS_MAXDATA)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_readres(xdrs, objp) - XDR *xdrs; - readres *objp; -{ - if (!xdr_nfsstat(xdrs, &objp->status)) { - return (FALSE); - } - switch (objp->status) { - case NFS_OK: - if (!xdr_readokres(xdrs, &objp->readres_u.reply)) { - return (FALSE); - } - break; - } - return (TRUE); -} - - - - -bool_t -xdr_writeargs(xdrs, objp) - XDR *xdrs; - writeargs *objp; -{ - if (!xdr_nfs_fh(xdrs, &objp->file)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->beginoffset)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->offset)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->totalcount)) { - return (FALSE); - } - if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, NFS_MAXDATA)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_createargs(xdrs, objp) - XDR *xdrs; - createargs *objp; -{ - if (!xdr_diropargs(xdrs, &objp->where)) { - return (FALSE); - } - if (!xdr_sattr(xdrs, &objp->attributes)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_renameargs(xdrs, objp) - XDR *xdrs; - renameargs *objp; -{ - if (!xdr_diropargs(xdrs, &objp->from)) { - return (FALSE); - } - if (!xdr_diropargs(xdrs, &objp->to)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_linkargs(xdrs, objp) - XDR *xdrs; - linkargs *objp; -{ - if (!xdr_nfs_fh(xdrs, &objp->from)) { - return (FALSE); - } - if (!xdr_diropargs(xdrs, &objp->to)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_symlinkargs(xdrs, objp) - XDR *xdrs; - symlinkargs *objp; -{ - if (!xdr_diropargs(xdrs, &objp->from)) { - return (FALSE); - } - if (!xdr_nfspath(xdrs, &objp->to)) { - return (FALSE); - } - if (!xdr_sattr(xdrs, &objp->attributes)) { - return (FALSE); - } - return (TRUE); -} - - - - -static bool_t -xdr_nfscookie(xdrs, objp) - XDR *xdrs; - nfscookie objp; -{ - if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_readdirargs(xdrs, objp) - XDR *xdrs; - readdirargs *objp; -{ - if (!xdr_nfs_fh(xdrs, &objp->dir)) { - return (FALSE); - } - if (!xdr_nfscookie(xdrs, objp->cookie)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->count)) { - return (FALSE); - } - return (TRUE); -} - - - - -static bool_t -xdr_entry(xdrs, objp) - XDR *xdrs; - entry *objp; -{ - if (!xdr_u_int(xdrs, &objp->fileid)) { - return (FALSE); - } - if (!xdr_filename(xdrs, &objp->name)) { - return (FALSE); - } - if (!xdr_nfscookie(xdrs, objp->cookie)) { - return (FALSE); - } - if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(entry), xdr_entry)) { - return (FALSE); - } - return (TRUE); -} - - - - -static bool_t -xdr_dirlist(xdrs, objp) - XDR *xdrs; - dirlist *objp; -{ - if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof(entry), xdr_entry)) { - return (FALSE); - } - if (!xdr_bool(xdrs, &objp->eof)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_readdirres(xdrs, objp) - XDR *xdrs; - readdirres *objp; -{ - if (!xdr_nfsstat(xdrs, &objp->status)) { - return (FALSE); - } - switch (objp->status) { - case NFS_OK: - if (!xdr_dirlist(xdrs, &objp->readdirres_u.reply)) { - return (FALSE); - } - break; - } - return (TRUE); -} - - - - -bool_t -xdr_statfsokres(xdrs, objp) - XDR *xdrs; - statfsokres *objp; -{ - if (!xdr_u_int(xdrs, &objp->tsize)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->bsize)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->blocks)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->bfree)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->bavail)) { - return (FALSE); - } - return (TRUE); -} - - - - -bool_t -xdr_statfsres(xdrs, objp) - XDR *xdrs; - statfsres *objp; -{ - if (!xdr_nfsstat(xdrs, &objp->status)) { - return (FALSE); - } - switch (objp->status) { - case NFS_OK: - if (!xdr_statfsokres(xdrs, &objp->statfsres_u.reply)) { - return (FALSE); - } - break; - } - return (TRUE); -}