diff options
-rw-r--r-- | usr.sbin/amd/amd/nfs_subr.c | 38 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/Makefile | 36 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/amq_svc.ed | 24 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot.ed | 34 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot.h | 507 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot.x | 375 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot_svc.c | 197 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot_svc.ed | 11 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot_xdr.c | 536 |
9 files changed, 1129 insertions, 629 deletions
diff --git a/usr.sbin/amd/amd/nfs_subr.c b/usr.sbin/amd/amd/nfs_subr.c index 93170d4febb..76f3df230b1 100644 --- a/usr.sbin/amd/amd/nfs_subr.c +++ b/usr.sbin/amd/amd/nfs_subr.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)nfs_subr.c 8.1 (Berkeley) 6/6/93 - * $Id: nfs_subr.c,v 1.8 2014/10/26 03:28:41 guenther Exp $ + * $Id: nfs_subr.c,v 1.9 2015/01/22 03:43:58 guenther Exp $ */ #include "am.h" @@ -79,7 +79,7 @@ do_readlink(am_node *mp, int *error_return, struct attrstat **attrpp) } void * -nfsproc_null_2(void *argp, struct svc_req *rqstp) +nfsproc_null_2_svc(void *argp, struct svc_req *rqstp) { static char res; @@ -88,7 +88,7 @@ nfsproc_null_2(void *argp, struct svc_req *rqstp) struct attrstat * -nfsproc_getattr_2(struct nfs_fh *argp, struct svc_req *rqstp) +nfsproc_getattr_2_svc(struct nfs_fh *argp, struct svc_req *rqstp) { static struct attrstat res; am_node *mp; @@ -130,7 +130,7 @@ getattr_retry: struct attrstat * -nfsproc_setattr_2(struct sattrargs *argp, struct svc_req *rqstp) +nfsproc_setattr_2_svc(struct sattrargs *argp, struct svc_req *rqstp) { static struct attrstat res; @@ -144,7 +144,7 @@ nfsproc_setattr_2(struct sattrargs *argp, struct svc_req *rqstp) void * -nfsproc_root_2(void *argp, struct svc_req *rqstp) +nfsproc_root_2_svc(void *argp, struct svc_req *rqstp) { static char res; @@ -153,7 +153,7 @@ nfsproc_root_2(void *argp, struct svc_req *rqstp) struct diropres * -nfsproc_lookup_2(struct diropargs *argp, struct svc_req *rqstp) +nfsproc_lookup_2_svc(struct diropargs *argp, struct svc_req *rqstp) { static struct diropres res; am_node *mp; @@ -200,7 +200,7 @@ nfsproc_lookup_2(struct diropargs *argp, struct svc_req *rqstp) struct readlinkres * -nfsproc_readlink_2(struct nfs_fh *argp, struct svc_req *rqstp) +nfsproc_readlink_2_svc(struct nfs_fh *argp, struct svc_req *rqstp) { static struct readlinkres res; am_node *mp; @@ -236,7 +236,7 @@ readlink_retry: struct readres * -nfsproc_read_2(struct readargs *argp, struct svc_req *rqstp) +nfsproc_read_2_svc(struct readargs *argp, struct svc_req *rqstp) { static struct readres res; @@ -249,7 +249,7 @@ nfsproc_read_2(struct readargs *argp, struct svc_req *rqstp) void * -nfsproc_writecache_2(void *argp, struct svc_req *rqstp) +nfsproc_writecache_2_svc(void *argp, struct svc_req *rqstp) { static char res; @@ -258,7 +258,7 @@ nfsproc_writecache_2(void *argp, struct svc_req *rqstp) struct attrstat * -nfsproc_write_2(writeargs *argp, struct svc_req *rqstp) +nfsproc_write_2_svc(writeargs *argp, struct svc_req *rqstp) { static struct attrstat res; @@ -272,7 +272,7 @@ nfsproc_write_2(writeargs *argp, struct svc_req *rqstp) struct diropres * -nfsproc_create_2(createargs *argp, struct svc_req *rqstp) +nfsproc_create_2_svc(createargs *argp, struct svc_req *rqstp) { static struct diropres res; @@ -333,13 +333,13 @@ out: nfsstat * -nfsproc_remove_2(struct diropargs *argp, struct svc_req *rqstp) +nfsproc_remove_2_svc(struct diropargs *argp, struct svc_req *rqstp) { return unlink_or_rmdir(argp, rqstp, TRUE); } nfsstat * -nfsproc_rename_2(renameargs *argp, struct svc_req *rqstp) +nfsproc_rename_2_svc(renameargs *argp, struct svc_req *rqstp) { static nfsstat res; if (!fh_to_mp(&argp->from.dir) || !fh_to_mp(&argp->to.dir)) @@ -360,7 +360,7 @@ nfsproc_rename_2(renameargs *argp, struct svc_req *rqstp) nfsstat * -nfsproc_link_2(linkargs *argp, struct svc_req *rqstp) +nfsproc_link_2_svc(linkargs *argp, struct svc_req *rqstp) { static nfsstat res; if (!fh_to_mp(&argp->from) || !fh_to_mp(&argp->to.dir)) @@ -373,7 +373,7 @@ nfsproc_link_2(linkargs *argp, struct svc_req *rqstp) nfsstat * -nfsproc_symlink_2(symlinkargs *argp, struct svc_req *rqstp) +nfsproc_symlink_2_svc(symlinkargs *argp, struct svc_req *rqstp) { static nfsstat res; if (!fh_to_mp(&argp->from.dir)) @@ -386,7 +386,7 @@ nfsproc_symlink_2(symlinkargs *argp, struct svc_req *rqstp) struct diropres * -nfsproc_mkdir_2(createargs *argp, struct svc_req *rqstp) +nfsproc_mkdir_2_svc(createargs *argp, struct svc_req *rqstp) { static struct diropres res; if (!fh_to_mp(&argp->where.dir)) @@ -399,14 +399,14 @@ nfsproc_mkdir_2(createargs *argp, struct svc_req *rqstp) nfsstat * -nfsproc_rmdir_2(struct diropargs *argp, struct svc_req *rqstp) +nfsproc_rmdir_2_svc(struct diropargs *argp, struct svc_req *rqstp) { return unlink_or_rmdir(argp, rqstp, FALSE); } struct readdirres * -nfsproc_readdir_2(readdirargs *argp, struct svc_req *rqstp) +nfsproc_readdir_2_svc(readdirargs *argp, struct svc_req *rqstp) { static readdirres res; static entry e_res[MAX_READDIR_ENTRIES]; @@ -437,7 +437,7 @@ nfsproc_readdir_2(readdirargs *argp, struct svc_req *rqstp) } struct statfsres * -nfsproc_statfs_2(struct nfs_fh *argp, struct svc_req *rqstp) +nfsproc_statfs_2_svc(struct nfs_fh *argp, struct svc_req *rqstp) { static statfsres res; am_node *mp; diff --git a/usr.sbin/amd/rpcx/Makefile b/usr.sbin/amd/rpcx/Makefile index a9c4e77f74c..4bc267502ea 100644 --- a/usr.sbin/amd/rpcx/Makefile +++ b/usr.sbin/amd/rpcx/Makefile @@ -1,20 +1,34 @@ RPCGEN = rpcgen -C -AMQ_SVC_EXTRA = amq_svc.extra +AMQ = amq.h amq_clnt.c amq_svc.c amq_xdr.c +NFS = nfs_prot.h nfs_prot_svc.c nfs_prot_xdr.c -all: amq.h amq_clnt.c amq_svc.c amq_xdr.c +NFSX = /usr/include/rpcsvc/nfs_prot.x -amq.h: amq.x - ${RPCGEN} -o $@ -h amq.x -amq_xdr.c: amq.x - ${RPCGEN} -o $@ -c -i 100 amq.x -amq_clnt.c: amq.x - ${RPCGEN} -o $@ -l amq.x -amq_svc.c: amq.x ${AMQ_SVC_EXTRA} Makefile +all: ${AMQ} ${NFS} + +.SUFFIXES: +.SUFFIXES: .x .h _xdr.c _clnt.c .c + +.x.h: + ${RPCGEN} -o $@ -h $< +.x_xdr.c: + ${RPCGEN} -o $@ -c -i 100 $< +.x_clnt.c: + ${RPCGEN} -o $@ -l $< + +amq_svc.c: amq.x $*.ed ${RPCGEN} -o $@.tmp -m amq.x - printf '/"amq.h"/a\n#include "am.h"\n#include <arpa/inet.h>\n.\n/_msgout(/-1,/^}/d\n/local/r %s\n/_msgout/\n.,+1c\n\t\tplog(XLOG_FATAL, "unable to free rpc arguments in amqprog");\n\t\tgoing_down(1);\n.\ng/_rpcsvcdirty/d\nwq\n' ${AMQ_SVC_EXTRA} | \ - ed -s $@.tmp >/dev/null + ed -s $@.tmp <$*.ed mv $@.tmp $@ +nfs_prot_svc.c: nfs_prot.x $*.ed + ${RPCGEN} -o $@.tmp -m nfs_prot.x + ed -s $@.tmp <$*.ed + mv $@.tmp $@ +nfs_prot.x: ${NFSX} $*.ed + cat ${NFSX} >$@.tmp + ed -s $@.tmp <$*.ed + mv $@.tmp $@ diff --git a/usr.sbin/amd/rpcx/amq_svc.ed b/usr.sbin/amd/rpcx/amq_svc.ed new file mode 100644 index 00000000000..f2bbb3e27b1 --- /dev/null +++ b/usr.sbin/amd/rpcx/amq_svc.ed @@ -0,0 +1,24 @@ +/"amq.h"/a +#include "am.h" +#include <arpa/inet.h> +. +/_msgout(/-1,/^}/d +/local/a + extern SVCXPRT *lamqp; + + if (transp != lamqp) { + struct sockaddr_in *fromsin = svc_getcaller(transp); + + syslog(LOG_WARNING, + "non-local amq attempt (might be from %s)", + inet_ntoa(fromsin->sin_addr)); + svcerr_noproc(transp); + return; + } +. +/_msgout/;+1c + plog(XLOG_FATAL, "unable to free rpc arguments in amqprog"); + going_down(1); +. +g/_rpcsvcdirty/d +wq diff --git a/usr.sbin/amd/rpcx/nfs_prot.ed b/usr.sbin/amd/rpcx/nfs_prot.ed new file mode 100644 index 00000000000..0cc7b7e2f9a --- /dev/null +++ b/usr.sbin/amd/rpcx/nfs_prot.ed @@ -0,0 +1,34 @@ +/^const NFS_FHSIZE/a +const NFSX_V2FH = 32; +const NFSX_V3FHMAX = 64; +. +/^enum nfsstat /i +#ifdef RPC_HDR +%typedef int nfsstat; +%#define xdr_nfsstat xdr_int +#define nfsstat int +. ++1s/^enum nfsstat /enum / +.,/^};/s/^/\%/ +a +#elif RPC_XDR +#define nfsstat int +#else +typedef int nfsstat; +#endif +. +/^enum ftype /i +#ifdef RPC_HDR +%typedef int ftype; +#define ftype int +. ++1s/^enum ftype /enum / +.,/^};/s/^/\%/ +a +#elif RPC_XDR +#define ftype int +#else +typedef int ftype; +#endif +. +wq diff --git a/usr.sbin/amd/rpcx/nfs_prot.h b/usr.sbin/amd/rpcx/nfs_prot.h index 3ed3917bf8b..b31ae8fadcd 100644 --- a/usr.sbin/amd/rpcx/nfs_prot.h +++ b/usr.sbin/amd/rpcx/nfs_prot.h @@ -1,53 +1,22 @@ -/* $OpenBSD: nfs_prot.h,v 1.6 2014/10/26 03:03:34 guenther Exp $ */ - /* - * 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)nfs_prot.h 8.1 (Berkeley) 6/6/93 + * Please do not edit this file. + * It was generated using rpcgen. */ -#include <nfs/nfsproto.h> +#ifndef _NFS_PROT_H_RPCGEN +#define _NFS_PROT_H_RPCGEN + +#define RPCGEN_VERSION 199506 -#define xdr_nfsstat xdr_enum -#define xdr_ftype xdr_enum +#include <rpc/rpc.h> #define NFS_PORT 2049 -#ifndef NFS_MAXDATA #define NFS_MAXDATA 8192 -#endif #define NFS_MAXPATHLEN 1024 #define NFS_MAXNAMLEN 255 #define NFS_FHSIZE 32 +#define NFSX_V2FH 32 +#define NFSX_V3FHMAX 64 #define NFS_COOKIESIZE 4 #define NFS_FIFO_DEV -1 #define NFSMODE_FMT 0170000 @@ -58,22 +27,52 @@ #define NFSMODE_LNK 0120000 #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 - typedef int nfsstat; - -bool_t xdr_nfsstat(XDR *, nfsstat *); - - +#define xdr_nfsstat xdr_int +enum { + NFS_OK= 0, /* no error */ + NFSERR_PERM=1, /* Not owner */ + NFSERR_NOENT=2, /* No such file or directory */ + NFSERR_IO=5, /* I/O error */ + NFSERR_NXIO=6, /* No such device or address */ + NFSERR_ACCES=13, /* Permission denied */ + NFSERR_EXIST=17, /* File exists */ + NFSERR_NODEV=19, /* No such device */ + NFSERR_NOTDIR=20, /* Not a directory*/ + NFSERR_ISDIR=21, /* Is a directory */ + NFSERR_FBIG=27, /* File too large */ + NFSERR_NOSPC=28, /* No space left on device */ + NFSERR_ROFS=30, /* Read-only file system */ + NFSERR_NAMETOOLONG=63, /* File name too long */ + NFSERR_NOTEMPTY=66, /* Directory not empty */ + NFSERR_DQUOT=69, /* Disc quota exceeded */ + NFSERR_STALE=70, /* Stale NFS file handle */ + NFSERR_WFLUSH=99 /* write cache flushed */ +}; typedef int ftype; - -/* static bool_t xdr_ftype(XDR *, ftype *); */ - +enum { + NFNON = 0, /* non-file */ + NFREG = 1, /* regular file */ + NFDIR = 2, /* directory */ + NFBLK = 3, /* block special */ + NFCHR = 4, /* character special */ + NFLNK = 5, /* symbolic link */ + NFSOCK = 6, /* unix domain sockets */ + NFBAD = 7, /* unused */ + NFFIFO = 8 /* named pipe */ +}; struct nfs_fh { char data[NFS_FHSIZE]; }; typedef struct nfs_fh nfs_fh; -bool_t xdr_nfs_fh(XDR *, nfs_fh *); +#ifdef __cplusplus +extern "C" bool_t xdr_nfs_fh(XDR *, nfs_fh *); +#elif defined(__STDC__) +extern bool_t xdr_nfs_fh(XDR *, nfs_fh *); +#else /* Old Style C */ +bool_t xdr_nfs_fh(); +#endif /* Old Style C */ struct nfstime { @@ -81,11 +80,17 @@ struct nfstime { u_int useconds; }; typedef struct nfstime nfstime; -/* static bool_t xdr_nfstime(XDR *, nfstime *); */ +#ifdef __cplusplus +extern "C" bool_t xdr_nfstime(XDR *, nfstime *); +#elif defined(__STDC__) +extern bool_t xdr_nfstime(XDR *, nfstime *); +#else /* Old Style C */ +bool_t xdr_nfstime(); +#endif /* Old Style C */ struct fattr { - ftype type; + int type; u_int mode; u_int nlink; u_int uid; @@ -101,7 +106,13 @@ struct fattr { nfstime ctime; }; typedef struct fattr fattr; -/* static bool_t xdr_fattr(XDR *, fattr *); */ +#ifdef __cplusplus +extern "C" bool_t xdr_fattr(XDR *, fattr *); +#elif defined(__STDC__) +extern bool_t xdr_fattr(XDR *, fattr *); +#else /* Old Style C */ +bool_t xdr_fattr(); +#endif /* Old Style C */ struct sattr { @@ -113,25 +124,49 @@ struct sattr { nfstime mtime; }; typedef struct sattr sattr; -/* static bool_t xdr_sattr(XDR *, sattr *); */ +#ifdef __cplusplus +extern "C" bool_t xdr_sattr(XDR *, sattr *); +#elif defined(__STDC__) +extern bool_t xdr_sattr(XDR *, sattr *); +#else /* Old Style C */ +bool_t xdr_sattr(); +#endif /* Old Style C */ typedef char *filename; -/* static bool_t xdr_filename(XDR *, filename *); */ +#ifdef __cplusplus +extern "C" bool_t xdr_filename(XDR *, filename *); +#elif defined(__STDC__) +extern bool_t xdr_filename(XDR *, filename *); +#else /* Old Style C */ +bool_t xdr_filename(); +#endif /* Old Style C */ typedef char *nfspath; -bool_t xdr_nfspath(XDR *, nfspath *); +#ifdef __cplusplus +extern "C" bool_t xdr_nfspath(XDR *, nfspath *); +#elif defined(__STDC__) +extern bool_t xdr_nfspath(XDR *, nfspath *); +#else /* Old Style C */ +bool_t xdr_nfspath(); +#endif /* Old Style C */ struct attrstat { - nfsstat status; + int status; union { fattr attributes; } attrstat_u; }; typedef struct attrstat attrstat; -bool_t xdr_attrstat(XDR *, attrstat *); +#ifdef __cplusplus +extern "C" bool_t xdr_attrstat(XDR *, attrstat *); +#elif defined(__STDC__) +extern bool_t xdr_attrstat(XDR *, attrstat *); +#else /* Old Style C */ +bool_t xdr_attrstat(); +#endif /* Old Style C */ struct sattrargs { @@ -139,7 +174,13 @@ struct sattrargs { sattr attributes; }; typedef struct sattrargs sattrargs; -bool_t xdr_sattrargs(XDR *, sattrargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_sattrargs(XDR *, sattrargs *); +#elif defined(__STDC__) +extern bool_t xdr_sattrargs(XDR *, sattrargs *); +#else /* Old Style C */ +bool_t xdr_sattrargs(); +#endif /* Old Style C */ struct diropargs { @@ -147,7 +188,13 @@ struct diropargs { filename name; }; typedef struct diropargs diropargs; -bool_t xdr_diropargs(XDR *, diropargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_diropargs(XDR *, diropargs *); +#elif defined(__STDC__) +extern bool_t xdr_diropargs(XDR *, diropargs *); +#else /* Old Style C */ +bool_t xdr_diropargs(); +#endif /* Old Style C */ struct diropokres { @@ -155,27 +202,45 @@ struct diropokres { fattr attributes; }; typedef struct diropokres diropokres; -bool_t xdr_diropokres(XDR *, diropokres *); +#ifdef __cplusplus +extern "C" bool_t xdr_diropokres(XDR *, diropokres *); +#elif defined(__STDC__) +extern bool_t xdr_diropokres(XDR *, diropokres *); +#else /* Old Style C */ +bool_t xdr_diropokres(); +#endif /* Old Style C */ struct diropres { - nfsstat status; + int status; union { diropokres diropres; } diropres_u; }; typedef struct diropres diropres; -bool_t xdr_diropres(XDR *, diropres *); +#ifdef __cplusplus +extern "C" bool_t xdr_diropres(XDR *, diropres *); +#elif defined(__STDC__) +extern bool_t xdr_diropres(XDR *, diropres *); +#else /* Old Style C */ +bool_t xdr_diropres(); +#endif /* Old Style C */ struct readlinkres { - nfsstat status; + int status; union { nfspath data; } readlinkres_u; }; typedef struct readlinkres readlinkres; -bool_t xdr_readlinkres(XDR *, readlinkres *); +#ifdef __cplusplus +extern "C" bool_t xdr_readlinkres(XDR *, readlinkres *); +#elif defined(__STDC__) +extern bool_t xdr_readlinkres(XDR *, readlinkres *); +#else /* Old Style C */ +bool_t xdr_readlinkres(); +#endif /* Old Style C */ struct readargs { @@ -185,7 +250,13 @@ struct readargs { u_int totalcount; }; typedef struct readargs readargs; -bool_t xdr_readargs(XDR *, readargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_readargs(XDR *, readargs *); +#elif defined(__STDC__) +extern bool_t xdr_readargs(XDR *, readargs *); +#else /* Old Style C */ +bool_t xdr_readargs(); +#endif /* Old Style C */ struct readokres { @@ -196,17 +267,29 @@ struct readokres { } data; }; typedef struct readokres readokres; -bool_t xdr_readokres(XDR *, readokres *); +#ifdef __cplusplus +extern "C" bool_t xdr_readokres(XDR *, readokres *); +#elif defined(__STDC__) +extern bool_t xdr_readokres(XDR *, readokres *); +#else /* Old Style C */ +bool_t xdr_readokres(); +#endif /* Old Style C */ struct readres { - nfsstat status; + int status; union { readokres reply; } readres_u; }; typedef struct readres readres; -bool_t xdr_readres(XDR *, readres *); +#ifdef __cplusplus +extern "C" bool_t xdr_readres(XDR *, readres *); +#elif defined(__STDC__) +extern bool_t xdr_readres(XDR *, readres *); +#else /* Old Style C */ +bool_t xdr_readres(); +#endif /* Old Style C */ struct writeargs { @@ -220,7 +303,13 @@ struct writeargs { } data; }; typedef struct writeargs writeargs; -bool_t xdr_writeargs(XDR *, writeargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_writeargs(XDR *, writeargs *); +#elif defined(__STDC__) +extern bool_t xdr_writeargs(XDR *, writeargs *); +#else /* Old Style C */ +bool_t xdr_writeargs(); +#endif /* Old Style C */ struct createargs { @@ -228,7 +317,13 @@ struct createargs { sattr attributes; }; typedef struct createargs createargs; -bool_t xdr_createargs(XDR *, createargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_createargs(XDR *, createargs *); +#elif defined(__STDC__) +extern bool_t xdr_createargs(XDR *, createargs *); +#else /* Old Style C */ +bool_t xdr_createargs(); +#endif /* Old Style C */ struct renameargs { @@ -236,7 +331,13 @@ struct renameargs { diropargs to; }; typedef struct renameargs renameargs; -bool_t xdr_renameargs(XDR *, renameargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_renameargs(XDR *, renameargs *); +#elif defined(__STDC__) +extern bool_t xdr_renameargs(XDR *, renameargs *); +#else /* Old Style C */ +bool_t xdr_renameargs(); +#endif /* Old Style C */ struct linkargs { @@ -244,7 +345,13 @@ struct linkargs { diropargs to; }; typedef struct linkargs linkargs; -bool_t xdr_linkargs(XDR *, linkargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_linkargs(XDR *, linkargs *); +#elif defined(__STDC__) +extern bool_t xdr_linkargs(XDR *, linkargs *); +#else /* Old Style C */ +bool_t xdr_linkargs(); +#endif /* Old Style C */ struct symlinkargs { @@ -253,11 +360,23 @@ struct symlinkargs { sattr attributes; }; typedef struct symlinkargs symlinkargs; -bool_t xdr_symlinkargs(XDR *, symlinkargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_symlinkargs(XDR *, symlinkargs *); +#elif defined(__STDC__) +extern bool_t xdr_symlinkargs(XDR *, symlinkargs *); +#else /* Old Style C */ +bool_t xdr_symlinkargs(); +#endif /* Old Style C */ typedef char nfscookie[NFS_COOKIESIZE]; -/* static bool_t xdr_nfscookie(XDR *, nfscookie *); */ +#ifdef __cplusplus +extern "C" bool_t xdr_nfscookie(XDR *, nfscookie ); +#elif defined(__STDC__) +extern bool_t xdr_nfscookie(XDR *, nfscookie ); +#else /* Old Style C */ +bool_t xdr_nfscookie(); +#endif /* Old Style C */ struct readdirargs { @@ -266,7 +385,13 @@ struct readdirargs { u_int count; }; typedef struct readdirargs readdirargs; -bool_t xdr_readdirargs(XDR *, readdirargs *); +#ifdef __cplusplus +extern "C" bool_t xdr_readdirargs(XDR *, readdirargs *); +#elif defined(__STDC__) +extern bool_t xdr_readdirargs(XDR *, readdirargs *); +#else /* Old Style C */ +bool_t xdr_readdirargs(); +#endif /* Old Style C */ struct entry { @@ -276,7 +401,13 @@ struct entry { struct entry *nextentry; }; typedef struct entry entry; -/* static bool_t xdr_entry(XDR *, entry *); */ +#ifdef __cplusplus +extern "C" bool_t xdr_entry(XDR *, entry *); +#elif defined(__STDC__) +extern bool_t xdr_entry(XDR *, entry *); +#else /* Old Style C */ +bool_t xdr_entry(); +#endif /* Old Style C */ struct dirlist { @@ -284,17 +415,29 @@ struct dirlist { bool_t eof; }; typedef struct dirlist dirlist; -/* static bool_t xdr_dirlist(XDR *, dirlist *); */ +#ifdef __cplusplus +extern "C" bool_t xdr_dirlist(XDR *, dirlist *); +#elif defined(__STDC__) +extern bool_t xdr_dirlist(XDR *, dirlist *); +#else /* Old Style C */ +bool_t xdr_dirlist(); +#endif /* Old Style C */ struct readdirres { - nfsstat status; + int status; union { dirlist reply; } readdirres_u; }; typedef struct readdirres readdirres; -bool_t xdr_readdirres(XDR *, readdirres *); +#ifdef __cplusplus +extern "C" bool_t xdr_readdirres(XDR *, readdirres *); +#elif defined(__STDC__) +extern bool_t xdr_readdirres(XDR *, readdirres *); +#else /* Old Style C */ +bool_t xdr_readdirres(); +#endif /* Old Style C */ struct statfsokres { @@ -305,75 +448,201 @@ struct statfsokres { u_int bavail; }; typedef struct statfsokres statfsokres; -bool_t xdr_statfsokres(XDR *, statfsokres *); +#ifdef __cplusplus +extern "C" bool_t xdr_statfsokres(XDR *, statfsokres *); +#elif defined(__STDC__) +extern bool_t xdr_statfsokres(XDR *, statfsokres *); +#else /* Old Style C */ +bool_t xdr_statfsokres(); +#endif /* Old Style C */ struct statfsres { - nfsstat status; + int status; union { statfsokres reply; } statfsres_u; }; typedef struct statfsres statfsres; -bool_t xdr_statfsres(XDR *, statfsres *); +#ifdef __cplusplus +extern "C" bool_t xdr_statfsres(XDR *, statfsres *); +#elif defined(__STDC__) +extern bool_t xdr_statfsres(XDR *, statfsres *); +#else /* Old Style C */ +bool_t xdr_statfsres(); +#endif /* Old Style C */ #define NFS_PROGRAM ((u_long)100003) #define NFS_VERSION ((u_long)2) -/* Undef the version 3 ones, and define the v2 ones */ -#undef NFSPROC_NULL +#ifdef __cplusplus +#define NFSPROC_NULL ((u_long)0) +extern "C" void * nfsproc_null_2(void *, CLIENT *); +extern "C" void * nfsproc_null_2_svc(void *, struct svc_req *); +#define NFSPROC_GETATTR ((u_long)1) +extern "C" attrstat * nfsproc_getattr_2(nfs_fh *, CLIENT *); +extern "C" attrstat * nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +#define NFSPROC_SETATTR ((u_long)2) +extern "C" attrstat * nfsproc_setattr_2(sattrargs *, CLIENT *); +extern "C" attrstat * nfsproc_setattr_2_svc(sattrargs *, struct svc_req *); +#define NFSPROC_ROOT ((u_long)3) +extern "C" void * nfsproc_root_2(void *, CLIENT *); +extern "C" void * nfsproc_root_2_svc(void *, struct svc_req *); +#define NFSPROC_LOOKUP ((u_long)4) +extern "C" diropres * nfsproc_lookup_2(diropargs *, CLIENT *); +extern "C" diropres * nfsproc_lookup_2_svc(diropargs *, struct svc_req *); +#define NFSPROC_READLINK ((u_long)5) +extern "C" readlinkres * nfsproc_readlink_2(nfs_fh *, CLIENT *); +extern "C" readlinkres * nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +#define NFSPROC_READ ((u_long)6) +extern "C" readres * nfsproc_read_2(readargs *, CLIENT *); +extern "C" readres * nfsproc_read_2_svc(readargs *, struct svc_req *); +#define NFSPROC_WRITECACHE ((u_long)7) +extern "C" void * nfsproc_writecache_2(void *, CLIENT *); +extern "C" void * nfsproc_writecache_2_svc(void *, struct svc_req *); +#define NFSPROC_WRITE ((u_long)8) +extern "C" attrstat * nfsproc_write_2(writeargs *, CLIENT *); +extern "C" attrstat * nfsproc_write_2_svc(writeargs *, struct svc_req *); +#define NFSPROC_CREATE ((u_long)9) +extern "C" diropres * nfsproc_create_2(createargs *, CLIENT *); +extern "C" diropres * nfsproc_create_2_svc(createargs *, struct svc_req *); +#define NFSPROC_REMOVE ((u_long)10) +extern "C" int * nfsproc_remove_2(diropargs *, CLIENT *); +extern "C" int * nfsproc_remove_2_svc(diropargs *, struct svc_req *); +#define NFSPROC_RENAME ((u_long)11) +extern "C" int * nfsproc_rename_2(renameargs *, CLIENT *); +extern "C" int * nfsproc_rename_2_svc(renameargs *, struct svc_req *); +#define NFSPROC_LINK ((u_long)12) +extern "C" int * nfsproc_link_2(linkargs *, CLIENT *); +extern "C" int * nfsproc_link_2_svc(linkargs *, struct svc_req *); +#define NFSPROC_SYMLINK ((u_long)13) +extern "C" int * nfsproc_symlink_2(symlinkargs *, CLIENT *); +extern "C" int * nfsproc_symlink_2_svc(symlinkargs *, struct svc_req *); +#define NFSPROC_MKDIR ((u_long)14) +extern "C" diropres * nfsproc_mkdir_2(createargs *, CLIENT *); +extern "C" diropres * nfsproc_mkdir_2_svc(createargs *, struct svc_req *); +#define NFSPROC_RMDIR ((u_long)15) +extern "C" int * nfsproc_rmdir_2(diropargs *, CLIENT *); +extern "C" int * nfsproc_rmdir_2_svc(diropargs *, struct svc_req *); +#define NFSPROC_READDIR ((u_long)16) +extern "C" readdirres * nfsproc_readdir_2(readdirargs *, CLIENT *); +extern "C" readdirres * nfsproc_readdir_2_svc(readdirargs *, struct svc_req *); +#define NFSPROC_STATFS ((u_long)17) +extern "C" statfsres * nfsproc_statfs_2(nfs_fh *, CLIENT *); +extern "C" statfsres * nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); + +#elif defined(__STDC__) +#define NFSPROC_NULL ((u_long)0) +extern void * nfsproc_null_2(void *, CLIENT *); +extern void * nfsproc_null_2_svc(void *, struct svc_req *); +#define NFSPROC_GETATTR ((u_long)1) +extern attrstat * nfsproc_getattr_2(nfs_fh *, CLIENT *); +extern attrstat * nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *); +#define NFSPROC_SETATTR ((u_long)2) +extern attrstat * nfsproc_setattr_2(sattrargs *, CLIENT *); +extern attrstat * nfsproc_setattr_2_svc(sattrargs *, struct svc_req *); +#define NFSPROC_ROOT ((u_long)3) +extern void * nfsproc_root_2(void *, CLIENT *); +extern void * nfsproc_root_2_svc(void *, struct svc_req *); +#define NFSPROC_LOOKUP ((u_long)4) +extern diropres * nfsproc_lookup_2(diropargs *, CLIENT *); +extern diropres * nfsproc_lookup_2_svc(diropargs *, struct svc_req *); +#define NFSPROC_READLINK ((u_long)5) +extern readlinkres * nfsproc_readlink_2(nfs_fh *, CLIENT *); +extern readlinkres * nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *); +#define NFSPROC_READ ((u_long)6) +extern readres * nfsproc_read_2(readargs *, CLIENT *); +extern readres * nfsproc_read_2_svc(readargs *, struct svc_req *); +#define NFSPROC_WRITECACHE ((u_long)7) +extern void * nfsproc_writecache_2(void *, CLIENT *); +extern void * nfsproc_writecache_2_svc(void *, struct svc_req *); +#define NFSPROC_WRITE ((u_long)8) +extern attrstat * nfsproc_write_2(writeargs *, CLIENT *); +extern attrstat * nfsproc_write_2_svc(writeargs *, struct svc_req *); +#define NFSPROC_CREATE ((u_long)9) +extern diropres * nfsproc_create_2(createargs *, CLIENT *); +extern diropres * nfsproc_create_2_svc(createargs *, struct svc_req *); +#define NFSPROC_REMOVE ((u_long)10) +extern int * nfsproc_remove_2(diropargs *, CLIENT *); +extern int * nfsproc_remove_2_svc(diropargs *, struct svc_req *); +#define NFSPROC_RENAME ((u_long)11) +extern int * nfsproc_rename_2(renameargs *, CLIENT *); +extern int * nfsproc_rename_2_svc(renameargs *, struct svc_req *); +#define NFSPROC_LINK ((u_long)12) +extern int * nfsproc_link_2(linkargs *, CLIENT *); +extern int * nfsproc_link_2_svc(linkargs *, struct svc_req *); +#define NFSPROC_SYMLINK ((u_long)13) +extern int * nfsproc_symlink_2(symlinkargs *, CLIENT *); +extern int * nfsproc_symlink_2_svc(symlinkargs *, struct svc_req *); +#define NFSPROC_MKDIR ((u_long)14) +extern diropres * nfsproc_mkdir_2(createargs *, CLIENT *); +extern diropres * nfsproc_mkdir_2_svc(createargs *, struct svc_req *); +#define NFSPROC_RMDIR ((u_long)15) +extern int * nfsproc_rmdir_2(diropargs *, CLIENT *); +extern int * nfsproc_rmdir_2_svc(diropargs *, struct svc_req *); +#define NFSPROC_READDIR ((u_long)16) +extern readdirres * nfsproc_readdir_2(readdirargs *, CLIENT *); +extern readdirres * nfsproc_readdir_2_svc(readdirargs *, struct svc_req *); +#define NFSPROC_STATFS ((u_long)17) +extern statfsres * nfsproc_statfs_2(nfs_fh *, CLIENT *); +extern statfsres * nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *); + +#else /* Old Style C */ #define NFSPROC_NULL ((u_long)0) -#undef NFSPROC_GETATTR +extern void * nfsproc_null_2(); +extern void * nfsproc_null_2_svc(); #define NFSPROC_GETATTR ((u_long)1) -#undef NFSPROC_SETATTR +extern attrstat * nfsproc_getattr_2(); +extern attrstat * nfsproc_getattr_2_svc(); #define NFSPROC_SETATTR ((u_long)2) -#undef NFSPROC_ROOT +extern attrstat * nfsproc_setattr_2(); +extern attrstat * nfsproc_setattr_2_svc(); #define NFSPROC_ROOT ((u_long)3) -#undef NFSPROC_LOOKUP +extern void * nfsproc_root_2(); +extern void * nfsproc_root_2_svc(); #define NFSPROC_LOOKUP ((u_long)4) -#undef NFSPROC_READLINK +extern diropres * nfsproc_lookup_2(); +extern diropres * nfsproc_lookup_2_svc(); #define NFSPROC_READLINK ((u_long)5) -#undef NFSPROC_READ +extern readlinkres * nfsproc_readlink_2(); +extern readlinkres * nfsproc_readlink_2_svc(); #define NFSPROC_READ ((u_long)6) -#undef NFSPROC_WRITECACHE +extern readres * nfsproc_read_2(); +extern readres * nfsproc_read_2_svc(); #define NFSPROC_WRITECACHE ((u_long)7) -#undef NFSPROC_WRITE +extern void * nfsproc_writecache_2(); +extern void * nfsproc_writecache_2_svc(); #define NFSPROC_WRITE ((u_long)8) -#undef NFSPROC_CREATE +extern attrstat * nfsproc_write_2(); +extern attrstat * nfsproc_write_2_svc(); #define NFSPROC_CREATE ((u_long)9) -#undef NFSPROC_REMOVE +extern diropres * nfsproc_create_2(); +extern diropres * nfsproc_create_2_svc(); #define NFSPROC_REMOVE ((u_long)10) -#undef NFSPROC_RENAME +extern int * nfsproc_remove_2(); +extern int * nfsproc_remove_2_svc(); #define NFSPROC_RENAME ((u_long)11) -#undef NFSPROC_LINK +extern int * nfsproc_rename_2(); +extern int * nfsproc_rename_2_svc(); #define NFSPROC_LINK ((u_long)12) -#undef NFSPROC_SYMLINK +extern int * nfsproc_link_2(); +extern int * nfsproc_link_2_svc(); #define NFSPROC_SYMLINK ((u_long)13) -#undef NFSPROC_MKDIR +extern int * nfsproc_symlink_2(); +extern int * nfsproc_symlink_2_svc(); #define NFSPROC_MKDIR ((u_long)14) -#undef NFSPROC_RMDIR +extern diropres * nfsproc_mkdir_2(); +extern diropres * nfsproc_mkdir_2_svc(); #define NFSPROC_RMDIR ((u_long)15) -#undef NFSPROC_READDIR +extern int * nfsproc_rmdir_2(); +extern int * nfsproc_rmdir_2_svc(); #define NFSPROC_READDIR ((u_long)16) -#undef NFSPROC_STATFS +extern readdirres * nfsproc_readdir_2(); +extern readdirres * nfsproc_readdir_2_svc(); #define NFSPROC_STATFS ((u_long)17) +extern statfsres * nfsproc_statfs_2(); +extern statfsres * nfsproc_statfs_2_svc(); +#endif /* Old Style C */ -extern void *nfsproc_null_2(void *, struct svc_req *); -extern attrstat *nfsproc_getattr_2(nfs_fh *, struct svc_req *); -extern attrstat *nfsproc_setattr_2(sattrargs *, struct svc_req *); -extern void *nfsproc_root_2(void *, struct svc_req *); -extern diropres *nfsproc_lookup_2(diropargs *, struct svc_req *); -extern readlinkres *nfsproc_readlink_2(nfs_fh *, struct svc_req *); -extern readres *nfsproc_read_2(readargs *, struct svc_req *); -extern void *nfsproc_writecache_2(void *, struct svc_req *); -extern attrstat *nfsproc_write_2(writeargs *, struct svc_req *); -extern diropres *nfsproc_create_2(createargs *, struct svc_req *); -extern nfsstat *nfsproc_remove_2(diropargs *, struct svc_req *); -extern nfsstat *nfsproc_rename_2(renameargs *, struct svc_req *); -extern nfsstat *nfsproc_link_2(linkargs *, struct svc_req *); -extern nfsstat *nfsproc_symlink_2(symlinkargs *, struct svc_req *); -extern diropres *nfsproc_mkdir_2(createargs *, struct svc_req *); -extern nfsstat *nfsproc_rmdir_2(diropargs *, struct svc_req *); -extern readdirres *nfsproc_readdir_2(readdirargs *, struct svc_req *); -extern statfsres *nfsproc_statfs_2(nfs_fh *, struct svc_req *); +#endif /* !_NFS_PROT_H_RPCGEN */ diff --git a/usr.sbin/amd/rpcx/nfs_prot.x b/usr.sbin/amd/rpcx/nfs_prot.x new file mode 100644 index 00000000000..230e372fa0f --- /dev/null +++ b/usr.sbin/amd/rpcx/nfs_prot.x @@ -0,0 +1,375 @@ +/* $OpenBSD: nfs_prot.x,v 1.1 2015/01/22 03:43:58 guenther Exp $ */ + +/* + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of the "Oracle America, Inc." 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + */ + +#ifndef RPC_HDR +#endif + +const NFS_PORT = 2049; +const NFS_MAXDATA = 8192; +const NFS_MAXPATHLEN = 1024; +const NFS_MAXNAMLEN = 255; +const NFS_FHSIZE = 32; +const NFSX_V2FH = 32; +const NFSX_V3FHMAX = 64; +const NFS_COOKIESIZE = 4; +const NFS_FIFO_DEV = -1; /* size kludge for named pipes */ + +/* + * File types + */ +const NFSMODE_FMT = 0170000; /* type of file */ +const NFSMODE_DIR = 0040000; /* directory */ +const NFSMODE_CHR = 0020000; /* character special */ +const NFSMODE_BLK = 0060000; /* block special */ +const NFSMODE_REG = 0100000; /* regular */ +const NFSMODE_LNK = 0120000; /* symbolic link */ +const NFSMODE_SOCK = 0140000; /* socket */ +const NFSMODE_FIFO = 0010000; /* fifo */ + +/* + * Error status + */ +#ifdef RPC_HDR +%typedef int nfsstat; +%#define xdr_nfsstat xdr_int +#define nfsstat int +%enum { +% NFS_OK= 0, /* no error */ +% NFSERR_PERM=1, /* Not owner */ +% NFSERR_NOENT=2, /* No such file or directory */ +% NFSERR_IO=5, /* I/O error */ +% NFSERR_NXIO=6, /* No such device or address */ +% NFSERR_ACCES=13, /* Permission denied */ +% NFSERR_EXIST=17, /* File exists */ +% NFSERR_NODEV=19, /* No such device */ +% NFSERR_NOTDIR=20, /* Not a directory*/ +% NFSERR_ISDIR=21, /* Is a directory */ +% NFSERR_FBIG=27, /* File too large */ +% NFSERR_NOSPC=28, /* No space left on device */ +% NFSERR_ROFS=30, /* Read-only file system */ +% NFSERR_NAMETOOLONG=63, /* File name too long */ +% NFSERR_NOTEMPTY=66, /* Directory not empty */ +% NFSERR_DQUOT=69, /* Disc quota exceeded */ +% NFSERR_STALE=70, /* Stale NFS file handle */ +% NFSERR_WFLUSH=99 /* write cache flushed */ +%}; +#elif RPC_XDR +#define nfsstat int +#else +typedef int nfsstat; +#endif + +/* + * File types + */ +#ifdef RPC_HDR +%typedef int ftype; +#define ftype int +%enum { +% NFNON = 0, /* non-file */ +% NFREG = 1, /* regular file */ +% NFDIR = 2, /* directory */ +% NFBLK = 3, /* block special */ +% NFCHR = 4, /* character special */ +% NFLNK = 5, /* symbolic link */ +% NFSOCK = 6, /* unix domain sockets */ +% NFBAD = 7, /* unused */ +% NFFIFO = 8 /* named pipe */ +%}; +#elif RPC_XDR +#define ftype int +#else +typedef int ftype; +#endif + +/* + * File access handle + */ +struct nfs_fh { + opaque data[NFS_FHSIZE]; +}; + +/* + * Timeval + */ +struct nfstime { + unsigned seconds; + unsigned useconds; +}; + + +/* + * File attributes + */ +struct fattr { + ftype type; /* file type */ + unsigned mode; /* protection mode bits */ + unsigned nlink; /* # hard links */ + unsigned uid; /* owner user id */ + unsigned gid; /* owner group id */ + unsigned size; /* file size in bytes */ + unsigned blocksize; /* prefered block size */ + unsigned rdev; /* special device # */ + unsigned blocks; /* Kb of disk used by file */ + unsigned fsid; /* device # */ + unsigned fileid; /* inode # */ + nfstime atime; /* time of last access */ + nfstime mtime; /* time of last modification */ + nfstime ctime; /* time of last change */ +}; + +/* + * File attributes which can be set + */ +struct sattr { + unsigned mode; /* protection mode bits */ + unsigned uid; /* owner user id */ + unsigned gid; /* owner group id */ + unsigned size; /* file size in bytes */ + nfstime atime; /* time of last access */ + nfstime mtime; /* time of last modification */ +}; + + +typedef string filename<NFS_MAXNAMLEN>; +typedef string nfspath<NFS_MAXPATHLEN>; + +/* + * Reply status with file attributes + */ +union attrstat switch (nfsstat status) { +case NFS_OK: + fattr attributes; +default: + void; +}; + +struct sattrargs { + nfs_fh file; + sattr attributes; +}; + +/* + * Arguments for directory operations + */ +struct diropargs { + nfs_fh dir; /* directory file handle */ + filename name; /* name (up to NFS_MAXNAMLEN bytes) */ +}; + +struct diropokres { + nfs_fh file; + fattr attributes; +}; + +/* + * Results from directory operation + */ +union diropres switch (nfsstat status) { +case NFS_OK: + diropokres diropres; +default: + void; +}; + +union readlinkres switch (nfsstat status) { +case NFS_OK: + nfspath data; +default: + void; +}; + +/* + * Arguments to remote read + */ +struct readargs { + nfs_fh file; /* handle for file */ + unsigned offset; /* byte offset in file */ + unsigned count; /* immediate read count */ + unsigned totalcount; /* total read count (from this offset)*/ +}; + +/* + * Status OK portion of remote read reply + */ +struct readokres { + fattr attributes; /* attributes, need for pagin*/ + opaque data<NFS_MAXDATA>; +}; + +union readres switch (nfsstat status) { +case NFS_OK: + readokres reply; +default: + void; +}; + +/* + * Arguments to remote write + */ +struct writeargs { + nfs_fh file; /* handle for file */ + unsigned beginoffset; /* beginning byte offset in file */ + unsigned offset; /* current byte offset in file */ + unsigned totalcount; /* total write count (to this offset)*/ + opaque data<NFS_MAXDATA>; +}; + +struct createargs { + diropargs where; + sattr attributes; +}; + +struct renameargs { + diropargs from; + diropargs to; +}; + +struct linkargs { + nfs_fh from; + diropargs to; +}; + +struct symlinkargs { + diropargs from; + nfspath to; + sattr attributes; +}; + + +typedef opaque nfscookie[NFS_COOKIESIZE]; + +/* + * Arguments to readdir + */ +struct readdirargs { + nfs_fh dir; /* directory handle */ + nfscookie cookie; + unsigned count; /* number of directory bytes to read */ +}; + +struct entry { + unsigned fileid; + filename name; + nfscookie cookie; + entry *nextentry; +}; + +struct dirlist { + entry *entries; + bool eof; +}; + +union readdirres switch (nfsstat status) { +case NFS_OK: + dirlist reply; +default: + void; +}; + +struct statfsokres { + unsigned tsize; /* preferred transfer size in bytes */ + unsigned bsize; /* fundamental file system block size */ + unsigned blocks; /* total blocks in file system */ + unsigned bfree; /* free blocks in fs */ + unsigned bavail; /* free blocks avail to non-superuser */ +}; + +union statfsres switch (nfsstat status) { +case NFS_OK: + statfsokres reply; +default: + void; +}; + +/* + * Remote file service routines + */ +program NFS_PROGRAM { + version NFS_VERSION { + void + NFSPROC_NULL(void) = 0; + + attrstat + NFSPROC_GETATTR(nfs_fh) = 1; + + attrstat + NFSPROC_SETATTR(sattrargs) = 2; + + void + NFSPROC_ROOT(void) = 3; + + diropres + NFSPROC_LOOKUP(diropargs) = 4; + + readlinkres + NFSPROC_READLINK(nfs_fh) = 5; + + readres + NFSPROC_READ(readargs) = 6; + + void + NFSPROC_WRITECACHE(void) = 7; + + attrstat + NFSPROC_WRITE(writeargs) = 8; + + diropres + NFSPROC_CREATE(createargs) = 9; + + nfsstat + NFSPROC_REMOVE(diropargs) = 10; + + nfsstat + NFSPROC_RENAME(renameargs) = 11; + + nfsstat + NFSPROC_LINK(linkargs) = 12; + + nfsstat + NFSPROC_SYMLINK(symlinkargs) = 13; + + diropres + NFSPROC_MKDIR(createargs) = 14; + + nfsstat + NFSPROC_RMDIR(diropargs) = 15; + + readdirres + NFSPROC_READDIR(readdirargs) = 16; + + statfsres + NFSPROC_STATFS(nfs_fh) = 17; + } = 2; +} = 100003; + diff --git a/usr.sbin/amd/rpcx/nfs_prot_svc.c b/usr.sbin/amd/rpcx/nfs_prot_svc.c index 4e80ce37f78..7290f2a5905 100644 --- a/usr.sbin/amd/rpcx/nfs_prot_svc.c +++ b/usr.sbin/amd/rpcx/nfs_prot_svc.c @@ -1,42 +1,42 @@ /* - * 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)nfs_prot_svc.c 8.1 (Berkeley) 6/6/93 - * $Id: nfs_prot_svc.c,v 1.4 2014/10/26 03:03:34 guenther Exp $ - * + * Please do not edit this file. + * It was generated using rpcgen. */ +#include "nfs_prot.h" #include "am.h" +#include <arpa/inet.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h>/* getenv, exit */ +#include <rpc/pmap_clnt.h> /* for pmap_unset */ +#include <string.h> /* strcmp */ +#include <netdb.h> +#include <signal.h> +#include <sys/ttycom.h>/* TIOCNOTTY */ +#ifdef __cplusplus +#include <sysent.h> /* getdtablesize, open */ +#endif /* __cplusplus */ +#include <memory.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <syslog.h> +#include <errno.h> + +#ifdef __STDC__ +#define SIG_PF void(*)(int) +#endif + +#ifdef DEBUG +#define RPC_SVC_FG +#endif + +#define _RPCSVC_CLOSEDOWN 120 +extern int _rpcpmstart; /* Started by a port monitor ? */ +extern int _rpcfdtype; /* Whether Stream or Datagram ? */ + + +void nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp); void nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp) @@ -59,133 +59,134 @@ nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp) nfs_fh nfsproc_statfs_2_arg; } argument; char *result; - bool_t (*xdr_argument)(), (*xdr_result)(); - char *(*local)(void *, struct svc_req *); + xdrproc_t xdr_argument, xdr_result; + char *(*local)(char *, struct svc_req *); switch (rqstp->rq_proc) { case NFSPROC_NULL: - xdr_argument = xdr_void; - xdr_result = xdr_void; - local = (char *(*)(void *, struct svc_req *)) nfsproc_null_2; + xdr_argument = (xdrproc_t) xdr_void; + xdr_result = (xdrproc_t) xdr_void; + local = (char *(*)(char *, struct svc_req *)) nfsproc_null_2_svc; break; case NFSPROC_GETATTR: - xdr_argument = xdr_nfs_fh; - xdr_result = xdr_attrstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_getattr_2; + xdr_argument = (xdrproc_t) xdr_nfs_fh; + xdr_result = (xdrproc_t) xdr_attrstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_getattr_2_svc; break; case NFSPROC_SETATTR: - xdr_argument = xdr_sattrargs; - xdr_result = xdr_attrstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_setattr_2; + xdr_argument = (xdrproc_t) xdr_sattrargs; + xdr_result = (xdrproc_t) xdr_attrstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_setattr_2_svc; break; case NFSPROC_ROOT: - xdr_argument = xdr_void; - xdr_result = xdr_void; - local = (char *(*)(void *, struct svc_req *)) nfsproc_root_2; + xdr_argument = (xdrproc_t) xdr_void; + xdr_result = (xdrproc_t) xdr_void; + local = (char *(*)(char *, struct svc_req *)) nfsproc_root_2_svc; break; case NFSPROC_LOOKUP: - xdr_argument = xdr_diropargs; - xdr_result = xdr_diropres; - local = (char *(*)(void *, struct svc_req *)) nfsproc_lookup_2; + xdr_argument = (xdrproc_t) xdr_diropargs; + xdr_result = (xdrproc_t) xdr_diropres; + local = (char *(*)(char *, struct svc_req *)) nfsproc_lookup_2_svc; break; case NFSPROC_READLINK: - xdr_argument = xdr_nfs_fh; - xdr_result = xdr_readlinkres; - local = (char *(*)(void *, struct svc_req *)) nfsproc_readlink_2; + xdr_argument = (xdrproc_t) xdr_nfs_fh; + xdr_result = (xdrproc_t) xdr_readlinkres; + local = (char *(*)(char *, struct svc_req *)) nfsproc_readlink_2_svc; break; case NFSPROC_READ: - xdr_argument = xdr_readargs; - xdr_result = xdr_readres; - local = (char *(*)(void *, struct svc_req *)) nfsproc_read_2; + xdr_argument = (xdrproc_t) xdr_readargs; + xdr_result = (xdrproc_t) xdr_readres; + local = (char *(*)(char *, struct svc_req *)) nfsproc_read_2_svc; break; case NFSPROC_WRITECACHE: - xdr_argument = xdr_void; - xdr_result = xdr_void; - local = (char *(*)(void *, struct svc_req *)) nfsproc_writecache_2; + xdr_argument = (xdrproc_t) xdr_void; + xdr_result = (xdrproc_t) xdr_void; + local = (char *(*)(char *, struct svc_req *)) nfsproc_writecache_2_svc; break; case NFSPROC_WRITE: - xdr_argument = xdr_writeargs; - xdr_result = xdr_attrstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_write_2; + xdr_argument = (xdrproc_t) xdr_writeargs; + xdr_result = (xdrproc_t) xdr_attrstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_write_2_svc; break; case NFSPROC_CREATE: - xdr_argument = xdr_createargs; - xdr_result = xdr_diropres; - local = (char *(*)(void *, struct svc_req *)) nfsproc_create_2; + xdr_argument = (xdrproc_t) xdr_createargs; + xdr_result = (xdrproc_t) xdr_diropres; + local = (char *(*)(char *, struct svc_req *)) nfsproc_create_2_svc; break; case NFSPROC_REMOVE: - xdr_argument = xdr_diropargs; - xdr_result = xdr_nfsstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_remove_2; + xdr_argument = (xdrproc_t) xdr_diropargs; + xdr_result = (xdrproc_t) xdr_nfsstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_remove_2_svc; break; case NFSPROC_RENAME: - xdr_argument = xdr_renameargs; - xdr_result = xdr_nfsstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_rename_2; + xdr_argument = (xdrproc_t) xdr_renameargs; + xdr_result = (xdrproc_t) xdr_nfsstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_rename_2_svc; break; case NFSPROC_LINK: - xdr_argument = xdr_linkargs; - xdr_result = xdr_nfsstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_link_2; + xdr_argument = (xdrproc_t) xdr_linkargs; + xdr_result = (xdrproc_t) xdr_nfsstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_link_2_svc; break; case NFSPROC_SYMLINK: - xdr_argument = xdr_symlinkargs; - xdr_result = xdr_nfsstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_symlink_2; + xdr_argument = (xdrproc_t) xdr_symlinkargs; + xdr_result = (xdrproc_t) xdr_nfsstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_symlink_2_svc; break; case NFSPROC_MKDIR: - xdr_argument = xdr_createargs; - xdr_result = xdr_diropres; - local = (char *(*)(void *, struct svc_req *)) nfsproc_mkdir_2; + xdr_argument = (xdrproc_t) xdr_createargs; + xdr_result = (xdrproc_t) xdr_diropres; + local = (char *(*)(char *, struct svc_req *)) nfsproc_mkdir_2_svc; break; case NFSPROC_RMDIR: - xdr_argument = xdr_diropargs; - xdr_result = xdr_nfsstat; - local = (char *(*)(void *, struct svc_req *)) nfsproc_rmdir_2; + xdr_argument = (xdrproc_t) xdr_diropargs; + xdr_result = (xdrproc_t) xdr_nfsstat; + local = (char *(*)(char *, struct svc_req *)) nfsproc_rmdir_2_svc; break; case NFSPROC_READDIR: - xdr_argument = xdr_readdirargs; - xdr_result = xdr_readdirres; - local = (char *(*)(void *, struct svc_req *)) nfsproc_readdir_2; + xdr_argument = (xdrproc_t) xdr_readdirargs; + xdr_result = (xdrproc_t) xdr_readdirres; + local = (char *(*)(char *, struct svc_req *)) nfsproc_readdir_2_svc; break; case NFSPROC_STATFS: - xdr_argument = xdr_nfs_fh; - xdr_result = xdr_statfsres; - local = (char *(*)(void *, struct svc_req *)) nfsproc_statfs_2; + xdr_argument = (xdrproc_t) xdr_nfs_fh; + xdr_result = (xdrproc_t) xdr_statfsres; + local = (char *(*)(char *, struct svc_req *)) nfsproc_statfs_2_svc; break; default: svcerr_noproc(transp); return; } - bzero((char *)&argument, sizeof(argument)); - if (!svc_getargs(transp, xdr_argument, (char *)&argument)) { + (void) memset((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { svcerr_decode(transp); return; } - result = (*local)(&argument, rqstp); - if (result != NULL && !svc_sendreply(transp, xdr_result, result)) + result = (*local)((char *)&argument, rqstp); + if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { svcerr_systemerr(transp); - if (!svc_freeargs(transp, xdr_argument, (char *)&argument)) { - plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program_1"); + } + if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { + plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program"); going_down(1); } + return; } - diff --git a/usr.sbin/amd/rpcx/nfs_prot_svc.ed b/usr.sbin/amd/rpcx/nfs_prot_svc.ed new file mode 100644 index 00000000000..3b240cbe1d1 --- /dev/null +++ b/usr.sbin/amd/rpcx/nfs_prot_svc.ed @@ -0,0 +1,11 @@ +/"nfs_prot.h"/a +#include "am.h" +#include <arpa/inet.h> +. +/_msgout(/-1,/^}/d +/_msgout/;+1c + plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program"); + going_down(1); +. +g/_rpcsvcdirty/d +wq diff --git a/usr.sbin/amd/rpcx/nfs_prot_xdr.c b/usr.sbin/amd/rpcx/nfs_prot_xdr.c index 696a8c752ef..2fdf66b52dd 100644 --- a/usr.sbin/amd/rpcx/nfs_prot_xdr.c +++ b/usr.sbin/amd/rpcx/nfs_prot_xdr.c @@ -1,625 +1,397 @@ /* - * 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)nfs_prot_xdr.c 8.1 (Berkeley) 6/6/93 - * $Id: nfs_prot_xdr.c,v 1.3 2003/06/02 23:36:52 millert Exp $ - * + * Please do not edit this file. + * It was generated using rpcgen. */ -#include "am.h" +#include "nfs_prot.h" - -#ifndef xdr_nfsstat bool_t -xdr_nfsstat(xdrs, objp) - XDR *xdrs; - nfsstat *objp; +xdr_nfs_fh(XDR *xdrs, nfs_fh *objp) { - if (!xdr_enum(xdrs, (enum_t *)objp)) { - return (FALSE); - } - return (TRUE); -} -#endif /* xdr_nfsstat */ - + int i; -#ifndef xdr_ftype -static bool_t -xdr_ftype(xdrs, objp) - XDR *xdrs; - ftype *objp; -{ - if (!xdr_enum(xdrs, (enum_t *)objp)) { + if (!xdr_opaque(xdrs, objp->data, NFS_FHSIZE)) return (FALSE); - } return (TRUE); } -#endif /* xdr_ftype */ - - bool_t -xdr_nfs_fh(xdrs, objp) - XDR *xdrs; - nfs_fh *objp; +xdr_nfstime(XDR *xdrs, nfstime *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)) { + if (!xdr_u_int(xdrs, &objp->seconds)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->useconds)) { + if (!xdr_u_int(xdrs, &objp->useconds)) return (FALSE); - } return (TRUE); } +bool_t +xdr_fattr(XDR *xdrs, fattr *objp) +{ - -static bool_t -xdr_fattr(xdrs, objp) - XDR *xdrs; - fattr *objp; -{ - if (!xdr_ftype(xdrs, (enum_t *) &objp->type)) { + if (!xdr_int(xdrs, &objp->type)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->mode)) { + if (!xdr_u_int(xdrs, &objp->mode)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->nlink)) { + if (!xdr_u_int(xdrs, &objp->nlink)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->uid)) { + if (!xdr_u_int(xdrs, &objp->uid)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->gid)) { + if (!xdr_u_int(xdrs, &objp->gid)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->size)) { + if (!xdr_u_int(xdrs, &objp->size)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->blocksize)) { + if (!xdr_u_int(xdrs, &objp->blocksize)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->rdev)) { + if (!xdr_u_int(xdrs, &objp->rdev)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->blocks)) { + if (!xdr_u_int(xdrs, &objp->blocks)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->fsid)) { + if (!xdr_u_int(xdrs, &objp->fsid)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->fileid)) { + if (!xdr_u_int(xdrs, &objp->fileid)) return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->atime)) { + if (!xdr_nfstime(xdrs, &objp->atime)) return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->mtime)) { + if (!xdr_nfstime(xdrs, &objp->mtime)) return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->ctime)) { + if (!xdr_nfstime(xdrs, &objp->ctime)) return (FALSE); - } return (TRUE); } +bool_t +xdr_sattr(XDR *xdrs, sattr *objp) +{ - -static bool_t -xdr_sattr(xdrs, objp) - XDR *xdrs; - sattr *objp; -{ - if (!xdr_u_int(xdrs, &objp->mode)) { + if (!xdr_u_int(xdrs, &objp->mode)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->uid)) { + if (!xdr_u_int(xdrs, &objp->uid)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->gid)) { + if (!xdr_u_int(xdrs, &objp->gid)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->size)) { + if (!xdr_u_int(xdrs, &objp->size)) return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->atime)) { + if (!xdr_nfstime(xdrs, &objp->atime)) return (FALSE); - } - if (!xdr_nfstime(xdrs, &objp->mtime)) { + if (!xdr_nfstime(xdrs, &objp->mtime)) return (FALSE); - } return (TRUE); } - - - -static bool_t -xdr_filename(xdrs, objp) - XDR *xdrs; - filename *objp; +bool_t +xdr_filename(XDR *xdrs, filename *objp) { - if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN)) { + + if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_nfspath(xdrs, objp) - XDR *xdrs; - nfspath *objp; +xdr_nfspath(XDR *xdrs, nfspath *objp) { - if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN)) { + + if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_attrstat(xdrs, objp) - XDR *xdrs; - attrstat *objp; +xdr_attrstat(XDR *xdrs, attrstat *objp) { - if (!xdr_nfsstat(xdrs, (enum_t *) &objp->status)) { + + if (!xdr_int(xdrs, &objp->status)) return (FALSE); - } switch (objp->status) { case NFS_OK: - if (!xdr_fattr(xdrs, &objp->attrstat_u.attributes)) { + if (!xdr_fattr(xdrs, &objp->attrstat_u.attributes)) return (FALSE); - } break; } return (TRUE); } - - - bool_t -xdr_sattrargs(xdrs, objp) - XDR *xdrs; - sattrargs *objp; +xdr_sattrargs(XDR *xdrs, sattrargs *objp) { - if (!xdr_nfs_fh(xdrs, &objp->file)) { + + + if (!xdr_nfs_fh(xdrs, &objp->file)) return (FALSE); - } - if (!xdr_sattr(xdrs, &objp->attributes)) { + if (!xdr_sattr(xdrs, &objp->attributes)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_diropargs(xdrs, objp) - XDR *xdrs; - diropargs *objp; +xdr_diropargs(XDR *xdrs, diropargs *objp) { - if (!xdr_nfs_fh(xdrs, &objp->dir)) { + + + if (!xdr_nfs_fh(xdrs, &objp->dir)) return (FALSE); - } - if (!xdr_filename(xdrs, &objp->name)) { + if (!xdr_filename(xdrs, &objp->name)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_diropokres(xdrs, objp) - XDR *xdrs; - diropokres *objp; +xdr_diropokres(XDR *xdrs, diropokres *objp) { - if (!xdr_nfs_fh(xdrs, &objp->file)) { + + + if (!xdr_nfs_fh(xdrs, &objp->file)) return (FALSE); - } - if (!xdr_fattr(xdrs, &objp->attributes)) { + if (!xdr_fattr(xdrs, &objp->attributes)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_diropres(xdrs, objp) - XDR *xdrs; - diropres *objp; +xdr_diropres(XDR *xdrs, diropres *objp) { - if (!xdr_nfsstat(xdrs, (enum_t *) &objp->status)) { + + if (!xdr_int(xdrs, &objp->status)) return (FALSE); - } switch (objp->status) { case NFS_OK: - if (!xdr_diropokres(xdrs, &objp->diropres_u.diropres)) { + if (!xdr_diropokres(xdrs, &objp->diropres_u.diropres)) return (FALSE); - } break; } return (TRUE); } - - - bool_t -xdr_readlinkres(xdrs, objp) - XDR *xdrs; - readlinkres *objp; +xdr_readlinkres(XDR *xdrs, readlinkres *objp) { - if (!xdr_nfsstat(xdrs, (enum_t *) &objp->status)) { + + if (!xdr_int(xdrs, &objp->status)) return (FALSE); - } switch (objp->status) { case NFS_OK: - if (!xdr_nfspath(xdrs, &objp->readlinkres_u.data)) { + if (!xdr_nfspath(xdrs, &objp->readlinkres_u.data)) return (FALSE); - } break; } return (TRUE); } - - - bool_t -xdr_readargs(xdrs, objp) - XDR *xdrs; - readargs *objp; +xdr_readargs(XDR *xdrs, readargs *objp) { - if (!xdr_nfs_fh(xdrs, &objp->file)) { + + + if (!xdr_nfs_fh(xdrs, &objp->file)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->offset)) { + if (!xdr_u_int(xdrs, &objp->offset)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->count)) { + if (!xdr_u_int(xdrs, &objp->count)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->totalcount)) { + if (!xdr_u_int(xdrs, &objp->totalcount)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_readokres(xdrs, objp) - XDR *xdrs; - readokres *objp; +xdr_readokres(XDR *xdrs, readokres *objp) { - if (!xdr_fattr(xdrs, &objp->attributes)) { + + + 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)) { + (u_int *)&objp->data.data_len, + NFS_MAXDATA)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_readres(xdrs, objp) - XDR *xdrs; - readres *objp; +xdr_readres(XDR *xdrs, readres *objp) { - if (!xdr_nfsstat(xdrs, (enum_t *) &objp->status)) { + + if (!xdr_int(xdrs, &objp->status)) return (FALSE); - } switch (objp->status) { case NFS_OK: - if (!xdr_readokres(xdrs, &objp->readres_u.reply)) { + if (!xdr_readokres(xdrs, &objp->readres_u.reply)) return (FALSE); - } break; } return (TRUE); } - - - bool_t -xdr_writeargs(xdrs, objp) - XDR *xdrs; - writeargs *objp; +xdr_writeargs(XDR *xdrs, writeargs *objp) { - if (!xdr_nfs_fh(xdrs, &objp->file)) { + + + if (!xdr_nfs_fh(xdrs, &objp->file)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->beginoffset)) { + if (!xdr_u_int(xdrs, &objp->beginoffset)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->offset)) { + if (!xdr_u_int(xdrs, &objp->offset)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->totalcount)) { + 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)) { + (u_int *)&objp->data.data_len, + NFS_MAXDATA)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_createargs(xdrs, objp) - XDR *xdrs; - createargs *objp; +xdr_createargs(XDR *xdrs, createargs *objp) { - if (!xdr_diropargs(xdrs, &objp->where)) { + + + if (!xdr_diropargs(xdrs, &objp->where)) return (FALSE); - } - if (!xdr_sattr(xdrs, &objp->attributes)) { + if (!xdr_sattr(xdrs, &objp->attributes)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_renameargs(xdrs, objp) - XDR *xdrs; - renameargs *objp; +xdr_renameargs(XDR *xdrs, renameargs *objp) { - if (!xdr_diropargs(xdrs, &objp->from)) { + + + if (!xdr_diropargs(xdrs, &objp->from)) return (FALSE); - } - if (!xdr_diropargs(xdrs, &objp->to)) { + if (!xdr_diropargs(xdrs, &objp->to)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_linkargs(xdrs, objp) - XDR *xdrs; - linkargs *objp; +xdr_linkargs(XDR *xdrs, linkargs *objp) { - if (!xdr_nfs_fh(xdrs, &objp->from)) { + + + if (!xdr_nfs_fh(xdrs, &objp->from)) return (FALSE); - } - if (!xdr_diropargs(xdrs, &objp->to)) { + if (!xdr_diropargs(xdrs, &objp->to)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_symlinkargs(xdrs, objp) - XDR *xdrs; - symlinkargs *objp; +xdr_symlinkargs(XDR *xdrs, symlinkargs *objp) { - if (!xdr_diropargs(xdrs, &objp->from)) { + + + if (!xdr_diropargs(xdrs, &objp->from)) return (FALSE); - } - if (!xdr_nfspath(xdrs, &objp->to)) { + if (!xdr_nfspath(xdrs, &objp->to)) return (FALSE); - } - if (!xdr_sattr(xdrs, &objp->attributes)) { + if (!xdr_sattr(xdrs, &objp->attributes)) return (FALSE); - } return (TRUE); } - - - -static bool_t -xdr_nfscookie(xdrs, objp) - XDR *xdrs; - nfscookie objp; +bool_t +xdr_nfscookie(XDR *xdrs, nfscookie objp) { - if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE)) { + + if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_readdirargs(xdrs, objp) - XDR *xdrs; - readdirargs *objp; +xdr_readdirargs(XDR *xdrs, readdirargs *objp) { - if (!xdr_nfs_fh(xdrs, &objp->dir)) { + + + if (!xdr_nfs_fh(xdrs, &objp->dir)) return (FALSE); - } - if (!xdr_nfscookie(xdrs, objp->cookie)) { + if (!xdr_nfscookie(xdrs, objp->cookie)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->count)) { + if (!xdr_u_int(xdrs, &objp->count)) return (FALSE); - } return (TRUE); } +bool_t +xdr_entry(XDR *xdrs, entry *objp) +{ - -static bool_t -xdr_entry(xdrs, objp) - XDR *xdrs; - entry *objp; -{ - if (!xdr_u_int(xdrs, &objp->fileid)) { + if (!xdr_u_int(xdrs, &objp->fileid)) return (FALSE); - } - if (!xdr_filename(xdrs, &objp->name)) { + if (!xdr_filename(xdrs, &objp->name)) return (FALSE); - } - if (!xdr_nfscookie(xdrs, objp->cookie)) { + if (!xdr_nfscookie(xdrs, objp->cookie)) return (FALSE); - } - if (!xdr_pointer(xdrs, (char **)&objp->nextentry, - sizeof(entry), xdr_entry)) { + if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(entry), (xdrproc_t)xdr_entry)) return (FALSE); - } return (TRUE); } +bool_t +xdr_dirlist(XDR *xdrs, dirlist *objp) +{ - -static bool_t -xdr_dirlist(xdrs, objp) - XDR *xdrs; - dirlist *objp; -{ - if (!xdr_pointer(xdrs, (char **)&objp->entries, - sizeof(entry), xdr_entry)) { + if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof(entry), (xdrproc_t)xdr_entry)) return (FALSE); - } - if (!xdr_bool(xdrs, &objp->eof)) { + if (!xdr_bool(xdrs, &objp->eof)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_readdirres(xdrs, objp) - XDR *xdrs; - readdirres *objp; +xdr_readdirres(XDR *xdrs, readdirres *objp) { - if (!xdr_nfsstat(xdrs, (enum_t *) &objp->status)) { + + if (!xdr_int(xdrs, &objp->status)) return (FALSE); - } switch (objp->status) { case NFS_OK: - if (!xdr_dirlist(xdrs, &objp->readdirres_u.reply)) { + if (!xdr_dirlist(xdrs, &objp->readdirres_u.reply)) return (FALSE); - } break; } return (TRUE); } - - - bool_t -xdr_statfsokres(xdrs, objp) - XDR *xdrs; - statfsokres *objp; +xdr_statfsokres(XDR *xdrs, statfsokres *objp) { - if (!xdr_u_int(xdrs, &objp->tsize)) { + + + if (!xdr_u_int(xdrs, &objp->tsize)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->bsize)) { + if (!xdr_u_int(xdrs, &objp->bsize)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->blocks)) { + if (!xdr_u_int(xdrs, &objp->blocks)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->bfree)) { + if (!xdr_u_int(xdrs, &objp->bfree)) return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->bavail)) { + if (!xdr_u_int(xdrs, &objp->bavail)) return (FALSE); - } return (TRUE); } - - - bool_t -xdr_statfsres(xdrs, objp) - XDR *xdrs; - statfsres *objp; +xdr_statfsres(XDR *xdrs, statfsres *objp) { - if (!xdr_nfsstat(xdrs, (enum_t *) &objp->status)) { + + if (!xdr_int(xdrs, &objp->status)) return (FALSE); - } switch (objp->status) { case NFS_OK: - if (!xdr_statfsokres(xdrs, &objp->statfsres_u.reply)) { + if (!xdr_statfsokres(xdrs, &objp->statfsres_u.reply)) return (FALSE); - } break; } return (TRUE); |