diff options
Diffstat (limited to 'usr.sbin/amd/rpcx')
-rw-r--r-- | usr.sbin/amd/rpcx/amq.h | 153 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/amq.x | 185 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/amq_clnt.c | 181 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/amq_svc.c | 136 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/amq_xdr.c | 251 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/mount.h | 124 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/mount_xdr.c | 206 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot.h | 389 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot_svc.c | 198 | ||||
-rw-r--r-- | usr.sbin/amd/rpcx/nfs_prot_xdr.c | 627 |
10 files changed, 2450 insertions, 0 deletions
diff --git a/usr.sbin/amd/rpcx/amq.h b/usr.sbin/amd/rpcx/amq.h new file mode 100644 index 0000000..7ec4d55 --- /dev/null +++ b/usr.sbin/amd/rpcx/amq.h @@ -0,0 +1,153 @@ +/* + * 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. + * + * @(#)amq.h 8.1 (Berkeley) 6/6/93 + * + * $Id: amq.h,v 5.2.2.1 1992/02/09 15:09:22 jsp beta $ + * + */ + +#define AMQ_STRLEN 1024 + +typedef char *amq_string; +bool_t xdr_amq_string(); + + +typedef long *time_type; +bool_t xdr_time_type(); + + +struct amq_mount_tree { + amq_string mt_mountinfo; + amq_string mt_directory; + amq_string mt_mountpoint; + amq_string mt_type; + time_type mt_mounttime; + u_short mt_mountuid; + int mt_getattr; + int mt_lookup; + int mt_readdir; + int mt_readlink; + int mt_statfs; + struct amq_mount_tree *mt_next; + struct amq_mount_tree *mt_child; +}; +typedef struct amq_mount_tree amq_mount_tree; +bool_t xdr_amq_mount_tree(); + + +typedef amq_mount_tree *amq_mount_tree_p; +bool_t xdr_amq_mount_tree_p(); + + +struct amq_mount_info { + amq_string mi_type; + amq_string mi_mountpt; + amq_string mi_mountinfo; + amq_string mi_fserver; + int mi_error; + int mi_refc; + int mi_up; +}; +typedef struct amq_mount_info amq_mount_info; +bool_t xdr_amq_mount_info(); + + +typedef struct { + u_int amq_mount_info_list_len; + amq_mount_info *amq_mount_info_list_val; +} amq_mount_info_list; +bool_t xdr_amq_mount_info_list(); + + +typedef struct { + u_int amq_mount_tree_list_len; + amq_mount_tree_p *amq_mount_tree_list_val; +} amq_mount_tree_list; +bool_t xdr_amq_mount_tree_list(); + + +struct amq_mount_stats { + int as_drops; + int as_stale; + int as_mok; + int as_merr; + int as_uerr; +}; +typedef struct amq_mount_stats amq_mount_stats; +bool_t xdr_amq_mount_stats(); + + +enum amq_opt { + AMOPT_DEBUG = 0, + AMOPT_LOGFILE = 1, + AMOPT_XLOG = 2, + AMOPT_FLUSHMAPC = 3 +}; +typedef enum amq_opt amq_opt; +bool_t xdr_amq_opt(); + + +struct amq_setopt { + amq_opt as_opt; + amq_string as_str; +}; +typedef struct amq_setopt amq_setopt; +bool_t xdr_amq_setopt(); + + +#define AMQ_PROGRAM ((u_long)300019) +#define AMQ_VERSION ((u_long)1) +#define AMQPROC_NULL ((u_long)0) +extern voidp amqproc_null_1(); +#define AMQPROC_MNTTREE ((u_long)1) +extern amq_mount_tree_p *amqproc_mnttree_1(); +#define AMQPROC_UMNT ((u_long)2) +extern voidp amqproc_umnt_1(); +#define AMQPROC_STATS ((u_long)3) +extern amq_mount_stats *amqproc_stats_1(); +#define AMQPROC_EXPORT ((u_long)4) +extern amq_mount_tree_list *amqproc_export_1(); +#define AMQPROC_SETOPT ((u_long)5) +extern int *amqproc_setopt_1(); +#define AMQPROC_GETMNTFS ((u_long)6) +extern amq_mount_info_list *amqproc_getmntfs_1(); +#define AMQPROC_MOUNT ((u_long)7) +extern int *amqproc_mount_1(); +#define AMQPROC_GETVERS ((u_long)8) +extern amq_string *amqproc_getvers_1(); + diff --git a/usr.sbin/amd/rpcx/amq.x b/usr.sbin/amd/rpcx/amq.x new file mode 100644 index 0000000..d75805d --- /dev/null +++ b/usr.sbin/amd/rpcx/amq.x @@ -0,0 +1,185 @@ +/* + * 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. + * + * @(#)amq.x 8.1 (Berkeley) 6/6/93 + * + * $Id: amq.x,v 5.2.2.1 1992/02/09 15:09:20 jsp beta $ + * + */ + +/* + * Protocol description used by the amq program + */ + +const AMQ_STRLEN = 1024; /* Maximum length of a pathname */ + +/* + * The type dirpath is the pathname of a directory + */ +typedef string amq_string<AMQ_STRLEN>; + +/* + * The type time_type should correspond to the system time_t + */ +typedef long time_type; + +/* + * A tree of what is mounted + */ +struct amq_mount_tree { + amq_string mt_mountinfo; /* Mounted filesystem */ + amq_string mt_directory; /* Virtual mount */ + amq_string mt_mountpoint; /* Mount point */ + amq_string mt_type; /* Filesystem type */ + time_type mt_mounttime; /* Mount time */ + u_short mt_mountuid; /* Mounter */ + int mt_getattr; /* Count of getattrs */ + int mt_lookup; /* Count of lookups */ + int mt_readdir; /* Count of readdirs */ + int mt_readlink; /* Count of readlinks */ + int mt_statfs; /* Count of statfss */ + amq_mount_tree *mt_next; /* Sibling mount tree */ + amq_mount_tree *mt_child; /* Child mount tree */ +}; +typedef amq_mount_tree *amq_mount_tree_p; + +/* + * List of mounted filesystems + */ +struct amq_mount_info { + amq_string mi_type; /* Type of mount */ + amq_string mi_mountpt; /* Mount point */ + amq_string mi_mountinfo; /* Mount info */ + amq_string mi_fserver; /* Fileserver */ + int mi_error; /* Error code */ + int mi_refc; /* References */ + int mi_up; /* Filesystem available */ +}; +typedef amq_mount_info amq_mount_info_list<>; + +/* + * A list of mount trees + */ +typedef amq_mount_tree_p amq_mount_tree_list<>; + +/* + * System wide stats + */ +struct amq_mount_stats { + int as_drops; /* Dropped requests */ + int as_stale; /* Stale NFS handles */ + int as_mok; /* Succesful mounts */ + int as_merr; /* Failed mounts */ + int as_uerr; /* Failed unmounts */ +}; + +enum amq_opt { + AMOPT_DEBUG=0, + AMOPT_LOGFILE=1, + AMOPT_XLOG=2, + AMOPT_FLUSHMAPC=3 +}; + +struct amq_setopt { + amq_opt as_opt; /* Option */ + amq_string as_str; /* String */ +}; + +program AMQ_PROGRAM { + version AMQ_VERSION { + /* + * Does no work. It is made available in all RPC services + * to allow server reponse testing and timing + */ + void + AMQPROC_NULL(void) = 0; + + /* + * Returned the mount tree descending from + * the given directory. The directory must + * be a top-level mount point of the automounter. + */ + amq_mount_tree_p + AMQPROC_MNTTREE(amq_string) = 1; + + /* + * Force a timeout unmount on the specified directory. + */ + void + AMQPROC_UMNT(amq_string) = 2; + + /* + * Obtain system wide statistics from the automounter + */ + amq_mount_stats + AMQPROC_STATS(void) = 3; + + /* + * Obtain full tree + */ + amq_mount_tree_list + AMQPROC_EXPORT(void) = 4; + + /* + * Control debug options. + * Return status: + * -1: debug not available + * 0: everything wonderful + * >0: number of options not recognised + */ + int + AMQPROC_SETOPT(amq_setopt) = 5; + + /* + * List of mounted filesystems + */ + amq_mount_info_list + AMQPROC_GETMNTFS(void) = 6; + + /* + * Mount a filesystem + */ + int + AMQPROC_MOUNT(amq_string) = 7; + + /* + * Get version info + */ + amq_string + AMQPROC_GETVERS(void) = 8; + } = 1; +} = 300019; /* Allocated by Sun, 89/8/29 */ diff --git a/usr.sbin/amd/rpcx/amq_clnt.c b/usr.sbin/amd/rpcx/amq_clnt.c new file mode 100644 index 0000000..5b70d11 --- /dev/null +++ b/usr.sbin/amd/rpcx/amq_clnt.c @@ -0,0 +1,181 @@ +/* + * 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. + * + * @(#)amq_clnt.c 8.1 (Berkeley) 6/6/93 + * + * $Id: amq_clnt.c,v 5.2.2.1 1992/02/09 15:09:24 jsp beta $ + * + */ + +#include "am.h" +#include "amq.h" + +static struct timeval TIMEOUT = { ALLOWED_MOUNT_TIME, 0 }; + +voidp +amqproc_null_1(argp, clnt) + voidp argp; + CLIENT *clnt; +{ + static char res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_NULL, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return ((voidp)&res); +} + + +amq_mount_tree_p * +amqproc_mnttree_1(argp, clnt) + amq_string *argp; + CLIENT *clnt; +{ + static amq_mount_tree_p res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_MNTTREE, xdr_amq_string, argp, xdr_amq_mount_tree_p, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&res); +} + + +voidp +amqproc_umnt_1(argp, clnt) + amq_string *argp; + CLIENT *clnt; +{ + static char res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_UMNT, xdr_amq_string, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return ((voidp)&res); +} + + +amq_mount_stats * +amqproc_stats_1(argp, clnt) + voidp argp; + CLIENT *clnt; +{ + static amq_mount_stats res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_STATS, xdr_void, argp, xdr_amq_mount_stats, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&res); +} + + +amq_mount_tree_list * +amqproc_export_1(argp, clnt) + voidp argp; + CLIENT *clnt; +{ + static amq_mount_tree_list res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_EXPORT, xdr_void, argp, xdr_amq_mount_tree_list, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&res); +} + +int * +amqproc_setopt_1(argp, clnt) + amq_setopt *argp; + CLIENT *clnt; +{ + static int res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_SETOPT, xdr_amq_setopt, argp, xdr_int, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&res); +} + + +amq_mount_info_list * +amqproc_getmntfs_1(argp, clnt) + voidp argp; + CLIENT *clnt; +{ + static amq_mount_info_list res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_GETMNTFS, xdr_void, argp, xdr_amq_mount_info_list, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&res); +} + + +int * +amqproc_mount_1(argp, clnt) + voidp argp; + CLIENT *clnt; +{ + static int res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_MOUNT, xdr_amq_string, argp, xdr_int, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&res); +} + + +amq_string * +amqproc_getvers_1(argp, clnt) + voidp argp; + CLIENT *clnt; +{ + static amq_string res; + + bzero((char *)&res, sizeof(res)); + if (clnt_call(clnt, AMQPROC_GETVERS, xdr_void, argp, xdr_amq_string, &res, TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&res); +} + diff --git a/usr.sbin/amd/rpcx/amq_svc.c b/usr.sbin/amd/rpcx/amq_svc.c new file mode 100644 index 0000000..0d3599f --- /dev/null +++ b/usr.sbin/amd/rpcx/amq_svc.c @@ -0,0 +1,136 @@ +/* + * 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. + * + * @(#)amq_svc.c 8.1 (Berkeley) 6/6/93 + * + * $Id: amq_svc.c,v 5.2.2.1 1992/02/09 15:09:26 jsp beta $ + * + */ + +#include "am.h" +#include "amq.h" +extern bool_t xdr_amq_mount_info_qelem(); + +void +amq_program_1(rqstp, transp) + struct svc_req *rqstp; + SVCXPRT *transp; +{ + union { + amq_string amqproc_mnttree_1_arg; + amq_string amqproc_umnt_1_arg; + amq_setopt amqproc_setopt_1_arg; + amq_string amqproc_mount_1_arg; + } argument; + char *result; + bool_t (*xdr_argument)(), (*xdr_result)(); + char *(*local)(); + + switch (rqstp->rq_proc) { + case AMQPROC_NULL: + xdr_argument = xdr_void; + xdr_result = xdr_void; + local = (char *(*)()) amqproc_null_1; + break; + + case AMQPROC_MNTTREE: + xdr_argument = xdr_amq_string; + xdr_result = xdr_amq_mount_tree_p; + local = (char *(*)()) amqproc_mnttree_1; + break; + + case AMQPROC_UMNT: + xdr_argument = xdr_amq_string; + xdr_result = xdr_void; + local = (char *(*)()) amqproc_umnt_1; + break; + + case AMQPROC_STATS: + xdr_argument = xdr_void; + xdr_result = xdr_amq_mount_stats; + local = (char *(*)()) amqproc_stats_1; + break; + + case AMQPROC_EXPORT: + xdr_argument = xdr_void; + xdr_result = xdr_amq_mount_tree_list; + local = (char *(*)()) amqproc_export_1; + break; + + case AMQPROC_SETOPT: + xdr_argument = xdr_amq_setopt; + xdr_result = xdr_int; + local = (char *(*)()) amqproc_setopt_1; + break; + + case AMQPROC_GETMNTFS: + xdr_argument = xdr_void; + xdr_result = xdr_amq_mount_info_qelem; + local = (char *(*)()) amqproc_getmntfs_1; + break; + + case AMQPROC_MOUNT: + xdr_argument = xdr_amq_string; + xdr_result = xdr_int; + local = (char *(*)()) amqproc_mount_1; + break; + + case AMQPROC_GETVERS: + xdr_argument = xdr_void; + xdr_result = xdr_amq_string; + local = (char *(*)()) amqproc_getvers_1; + 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 amqprog_1"); + going_down(1); + } +} + diff --git a/usr.sbin/amd/rpcx/amq_xdr.c b/usr.sbin/amd/rpcx/amq_xdr.c new file mode 100644 index 0000000..8a123a7 --- /dev/null +++ b/usr.sbin/amd/rpcx/amq_xdr.c @@ -0,0 +1,251 @@ +/* + * 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. + * + * @(#)amq_xdr.c 8.1 (Berkeley) 6/6/93 + * + * $Id: amq_xdr.c,v 5.2.2.1 1992/02/09 15:09:23 jsp beta $ + * + */ + +#include "am.h" +#include "amq.h" + + +bool_t +xdr_amq_string(xdrs, objp) + XDR *xdrs; + amq_string *objp; +{ + if (!xdr_string(xdrs, objp, AMQ_STRLEN)) { + return (FALSE); + } + return (TRUE); +} + + + + +bool_t +xdr_time_type(xdrs, objp) + XDR *xdrs; + time_type *objp; +{ + if (!xdr_long(xdrs, objp)) { + return (FALSE); + } + return (TRUE); +} + + + + +bool_t +xdr_amq_mount_tree(xdrs, objp) + XDR *xdrs; + amq_mount_tree *objp; +{ + if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) { + return (FALSE); + } + if (!xdr_amq_string(xdrs, &objp->mt_directory)) { + return (FALSE); + } + if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) { + return (FALSE); + } + if (!xdr_amq_string(xdrs, &objp->mt_type)) { + return (FALSE); + } + if (!xdr_time_type(xdrs, &objp->mt_mounttime)) { + return (FALSE); + } + if (!xdr_u_short(xdrs, &objp->mt_mountuid)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mt_getattr)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mt_lookup)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mt_readdir)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mt_readlink)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mt_statfs)) { + return (FALSE); + } + if (!xdr_pointer(xdrs, (char **)&objp->mt_next, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { + return (FALSE); + } + if (!xdr_pointer(xdrs, (char **)&objp->mt_child, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { + return (FALSE); + } + return (TRUE); +} + + + + +bool_t +xdr_amq_mount_tree_p(xdrs, objp) + XDR *xdrs; + amq_mount_tree_p *objp; +{ + if (!xdr_pointer(xdrs, (char **)objp, sizeof(amq_mount_tree), xdr_amq_mount_tree)) { + return (FALSE); + } + return (TRUE); +} + + + +bool_t +xdr_amq_mount_info(xdrs, objp) + XDR *xdrs; + amq_mount_info *objp; +{ + if (!xdr_amq_string(xdrs, &objp->mi_type)) { + return (FALSE); + } + if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) { + return (FALSE); + } + if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) { + return (FALSE); + } + if (!xdr_amq_string(xdrs, &objp->mi_fserver)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mi_error)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mi_refc)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->mi_up)) { + return (FALSE); + } + return (TRUE); +} + + + +bool_t +xdr_amq_mount_info_list(xdrs, objp) + XDR *xdrs; + amq_mount_info_list *objp; +{ + if (!xdr_array(xdrs, (char **)&objp->amq_mount_info_list_val, (u_int *)&objp->amq_mount_info_list_len, ~0, sizeof(amq_mount_info), xdr_amq_mount_info)) { + return (FALSE); + } + return (TRUE); +} + + + +bool_t +xdr_amq_mount_tree_list(xdrs, objp) + XDR *xdrs; + amq_mount_tree_list *objp; +{ + if (!xdr_array(xdrs, (char **)&objp->amq_mount_tree_list_val, (u_int *)&objp->amq_mount_tree_list_len, ~0, sizeof(amq_mount_tree_p), xdr_amq_mount_tree_p)) { + return (FALSE); + } + return (TRUE); +} + + + + +bool_t +xdr_amq_mount_stats(xdrs, objp) + XDR *xdrs; + amq_mount_stats *objp; +{ + if (!xdr_int(xdrs, &objp->as_drops)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->as_stale)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->as_mok)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->as_merr)) { + return (FALSE); + } + if (!xdr_int(xdrs, &objp->as_uerr)) { + return (FALSE); + } + return (TRUE); +} + + + + +bool_t +xdr_amq_opt(xdrs, objp) + XDR *xdrs; + amq_opt *objp; +{ + if (!xdr_enum(xdrs, (enum_t *)objp)) { + return (FALSE); + } + return (TRUE); +} + + + + +bool_t +xdr_amq_setopt(xdrs, objp) + XDR *xdrs; + amq_setopt *objp; +{ + if (!xdr_amq_opt(xdrs, &objp->as_opt)) { + return (FALSE); + } + if (!xdr_amq_string(xdrs, &objp->as_str)) { + return (FALSE); + } + return (TRUE); +} + + diff --git a/usr.sbin/amd/rpcx/mount.h b/usr.sbin/amd/rpcx/mount.h new file mode 100644 index 0000000..d30b0c3 --- /dev/null +++ b/usr.sbin/amd/rpcx/mount.h @@ -0,0 +1,124 @@ +/* + * 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: mount.h,v 5.2.2.1 1992/02/09 15:09:27 jsp beta $ + * + */ + +#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 new file mode 100644 index 0000000..f8d8f57 --- /dev/null +++ b/usr.sbin/amd/rpcx/mount_xdr.c @@ -0,0 +1,206 @@ +/* + * 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: mount_xdr.c,v 5.2.2.1 1992/02/09 15:09:28 jsp beta $ + * + */ + +#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 new file mode 100644 index 0000000..62a75f7 --- /dev/null +++ b/usr.sbin/amd/rpcx/nfs_prot.h @@ -0,0 +1,389 @@ +/* + * 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: nfs_prot.h,v 5.2.2.1 1992/02/09 15:09:29 jsp beta $ + * + */ + +#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 new file mode 100644 index 0000000..21e47e3 --- /dev/null +++ b/usr.sbin/amd/rpcx/nfs_prot_svc.c @@ -0,0 +1,198 @@ +/* + * 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: nfs_prot_svc.c,v 5.2.2.1 1992/02/09 15:09:30 jsp beta $ + * + */ + +#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 new file mode 100644 index 0000000..1786d01 --- /dev/null +++ b/usr.sbin/amd/rpcx/nfs_prot_xdr.c @@ -0,0 +1,627 @@ +/* + * 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: nfs_prot_xdr.c,v 5.2.2.1 1992/02/09 15:09:32 jsp beta $ + * + */ + +#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); +} |