From: Ronnie Sahlberg Date: Wed, 4 Jul 2012 06:53:12 +0000 (+1000) Subject: ZDR: New builtin replacement for RPC/XDR called ZDR X-Git-Tag: upstream/1.9.6^2~242^2~23 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=763cd6e3e2bbb6906186e7ed6a86660276b596b7 ZDR: New builtin replacement for RPC/XDR called ZDR This patch switches libnfs over to use precompiled rpcgen files and using ZDR. ZDR is a trivial reimplementation of XDR that is built in into libnfs. This removes the dependencies of rpc/xdr completely and allow us to build on any system, even systems where rpcgen and librpc/libxdr are not generally available. --- diff --git a/examples/nfsclient-async.c b/examples/nfsclient-async.c index c5d0df1..d386959 100644 --- a/examples/nfsclient-async.c +++ b/examples/nfsclient-async.c @@ -35,6 +35,7 @@ #include #include #include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-raw-mount.h" diff --git a/examples/nfsclient-bcast.c b/examples/nfsclient-bcast.c index 498e0e7..e73cfaf 100644 --- a/examples/nfsclient-bcast.c +++ b/examples/nfsclient-bcast.c @@ -30,8 +30,10 @@ #include #include #include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" +#include "libnfs-private.h" #include "libnfs-raw-mount.h" #include "libnfs-raw-portmap.h" diff --git a/examples/nfsclient-listservers.c b/examples/nfsclient-listservers.c index a00ee1c..c4fc41e 100644 --- a/examples/nfsclient-listservers.c +++ b/examples/nfsclient-listservers.c @@ -20,6 +20,7 @@ #include #include +#include "libnfs-zdr.h" #include "libnfs.h" diff --git a/examples/nfsclient-raw.c b/examples/nfsclient-raw.c index 19881d0..2e55d53 100644 --- a/examples/nfsclient-raw.c +++ b/examples/nfsclient-raw.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-raw-mount.h" diff --git a/examples/nfsclient-sync.c b/examples/nfsclient-sync.c index 8563c1e..aeb3eed 100644 --- a/examples/nfsclient-sync.c +++ b/examples/nfsclient-sync.c @@ -48,8 +48,8 @@ WSADATA wsaData; #include #include #include +#include "libnfs-zdr.h" #include "libnfs.h" -#include /* for authunix_create() */ #include "libnfs-raw.h" #include "libnfs-raw-mount.h" diff --git a/include/libnfs-private.h b/include/libnfs-private.h index a083b37..faa261c 100644 --- a/include/libnfs-private.h +++ b/include/libnfs-private.h @@ -14,8 +14,9 @@ You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ -#include -#include +#include /* struct sockaddr_storage */ + +#include "libnfs-zdr.h" struct rpc_fragment { struct rpc_fragment *next; @@ -64,7 +65,7 @@ struct rpc_pdu { struct rpc_pdu *next; unsigned long xid; - XDR xdr; + ZDR zdr; int written; struct rpc_data outdata; @@ -72,13 +73,13 @@ struct rpc_pdu { rpc_cb cb; void *private_data; - /* function to decode the xdr reply data and buffer to decode into */ - xdrproc_t xdr_decode_fn; - caddr_t xdr_decode_buf; - int xdr_decode_bufsize; + /* function to decode the zdr reply data and buffer to decode into */ + zdrproc_t zdr_decode_fn; + caddr_t zdr_decode_buf; + int zdr_decode_bufsize; }; -struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int version, int procedure, rpc_cb cb, void *private_data, xdrproc_t xdr_decode_fn, int xdr_bufsize); +struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int version, int procedure, rpc_cb cb, void *private_data, zdrproc_t zdr_decode_fn, int zdr_bufsize); void rpc_free_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu); int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu); int rpc_get_pdu_size(char *buf); diff --git a/include/libnfs-raw.h b/include/libnfs-raw.h index 6367320..0ede83c 100644 --- a/include/libnfs-raw.h +++ b/include/libnfs-raw.h @@ -20,8 +20,6 @@ * protocol as well as the XDR encoded/decoded structures. */ #include -#include -#include struct rpc_data { int size; diff --git a/include/libnfs-zdr.h b/include/libnfs-zdr.h new file mode 100644 index 0000000..660f3b1 --- /dev/null +++ b/include/libnfs-zdr.h @@ -0,0 +1,281 @@ +/* + Copyright (C) 2012 by Ronnie Sahlberg + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see . +*/ +/* + * This file contains definitions for the built in ZDR implementation. + * This is a very limited ZDR subset that can only marshal to/from a momory buffer, + * i.e. zdrmem_create() buffers. + * It aims to be compatible with normal rpcgen generated functions. + */ + +#include "config.h" + +#ifndef _LIBNFS_ZDR_H_ +#define _LIBNFS_ZDR_H_ + +#include +#include +#include +#include + +#define _RPC_RPC_H 1 +#define _RPC_ZDR_H 1 +#define _RPC_AUTH_H 1 + +/* we dont need these */ +typedef void CLIENT; +struct svc_req { +}; +typedef void SVCXPRT; + + + + + +#define ZDR_INLINE(...) NULL +#define IZDR_PUT_U_LONG(...) assert(0) +#define IZDR_GET_U_LONG(...) (assert(0), 0) +#define IZDR_PUT_LONG(...) assert(0) +#define IZDR_GET_LONG(...) (assert(0), 0) +#define IZDR_PUT_BOOL(...) assert(0) +#define IZDR_GET_BOOL(...) (assert(0), 0) + +#define TRUE 1 +#define FALSE 0 + +enum zdr_op { + ZDR_ENCODE = 0, + ZDR_DECODE = 1 +}; + +struct zdr_mem { + struct zdr_mem *next; + caddr_t buf; + uint32_t size; +}; + +struct ZDR { + enum zdr_op x_op; + caddr_t buf; + int size; + int pos; + struct zdr_mem *mem; +}; +typedef struct ZDR ZDR; + + +typedef uint32_t u_int; +typedef uint32_t enum_t; +typedef uint32_t bool_t; + +typedef int (*zdrproc_t) (ZDR *, void *,...); + +/* XXX find out what we can get rid of */ + +#define AUTH_NONE 0 +#define AUTH_NULL 0 +#define AUTH_UNIX 1 +struct opaque_auth { + uint32_t oa_flavor; + caddr_t oa_base; + uint32_t oa_length; +}; +extern struct opaque_auth _null_auth; + + +typedef struct { + struct opaque_auth ah_cred; + struct opaque_auth ah_verf; + caddr_t ah_private; +} AUTH; + +enum msg_type { + CALL=0, + REPLY=1 +}; + +#define RPC_MSG_VERSION 2 + +struct call_body { + uint32_t cb_rpcvers; + uint32_t cb_prog; + uint32_t cb_vers; + uint32_t cb_proc; + struct opaque_auth cb_cred; + struct opaque_auth cb_verf; +}; + +enum accept_stat { + SUCCESS=0, + PROG_UNAVAIL=1, + PROG_MISMATCH=2, + PROC_UNAVAIL=3, + GARBAGE_ARGS=4, + SYSTEM_ERR=5 +}; + +struct accepted_reply { + struct opaque_auth ar_verf; + uint32_t ar_stat; + union { + struct { + uint32_t low; + uint32_t high; + } AR_versions; + struct { + caddr_t where; + zdrproc_t proc; + } AR_results; + /* and many other null cases */ + } ru; +#define ar_results ru.AR_results +#define ar_vers ru.AR_versions +}; + +enum reject_stat { + RPC_MISMATCH=0, + AUTH_ERROR=1 +}; + +enum auth_stat { + AUTH_OK=0, + /* + * failed at remote end + */ + AUTH_BADCRED=1, /* bogus credentials (seal broken) */ + AUTH_REJECTEDCRED=2, /* client should begin new session */ + AUTH_BADVERF=3, /* bogus verifier (seal broken) */ + AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ + AUTH_TOOWEAK=5, /* rejected due to security reasons */ + /* + * failed locally + */ + AUTH_INVALIDRESP=6, /* bogus response verifier */ + AUTH_FAILED=7 /* some unknown reason */ +}; + +struct rejected_reply { + enum reject_stat rj_stat; + union { + struct { + u_long low; + u_long high; + } RJ_versions; + enum auth_stat RJ_why; /* why authentication did not work */ + } ru; +#define rj_vers ru.RJ_versions +#define rj_why ru.RJ_why +}; + +#define MSG_ACCEPTED 0 +#define MSG_DENIED 1 + +struct reply_body { + uint32_t rp_stat; + union { + struct accepted_reply RP_ar; + struct rejected_reply RP_dr; + } ru; +#define rp_acpt ru.RP_ar +#define rp_rjct ru.RP_dr +}; + +struct rpc_msg { + uint32_t rm_xid; + + uint32_t rm_direction; + union { + struct call_body RM_cmb; + struct reply_body RM_rmb; + } ru; +#define rm_call ru.RM_cmb +#define rm_reply ru.RM_rmb +}; +#define acpted_rply ru.RM_rmb.ru.RP_ar +#define rjcted_rply ru.RM_rmb.ru.RP_dr + + + +#define zdrmem_create libnfs_zdrmem_create +void libnfs_zdrmem_create(ZDR *zdrs, const caddr_t addr, uint32_t size, enum zdr_op xop); + +#define zdr_destroy libnfs_zdr_destroy +void libnfs_zdr_destroy(ZDR *zdrs); + +#define zdr_bytes libnfs_zdr_bytes +bool_t libnfs_zdr_bytes(ZDR *zdrs, char **bufp, uint32_t *size, uint32_t maxsize); + +#define zdr_u_int libnfs_zdr_u_int +bool_t libnfs_zdr_u_int(ZDR *zdrs, uint32_t *u); + +#define zdr_int libnfs_zdr_int +bool_t libnfs_zdr_int(ZDR *zdrs, int32_t *i); + +#define zdr_u_quad_t libnfs_zdr_u_quad_t +bool_t libnfs_zdr_u_quad_t(ZDR *zdrs, uint64_t *u); + +#define zdr_quad_t libnfs_zdr_quad_t +bool_t libnfs_zdr_quad_t(ZDR *zdrs, int64_t *i); + +#define zdr_enum libnfs_zdr_enum +bool_t libnfs_zdr_enum(ZDR *zdrs, int32_t *e); + +#define zdr_bool libnfs_zdr_bool +bool_t libnfs_zdr_bool(ZDR *zdrs, bool_t *b); + +#define zdr_void libnfs_zdr_void +bool_t libnfs_zdr_void(void); + +#define zdr_pointer libnfs_zdr_pointer +bool_t libnfs_zdr_pointer(ZDR *zdrs, char **objp, uint32_t size, zdrproc_t proc); + +#define zdr_opaque libnfs_zdr_opaque +bool_t libnfs_zdr_opaque(ZDR *zdrs, char *objp, uint32_t size); + +#define zdr_string libnfs_zdr_string +bool_t libnfs_zdr_string(ZDR *zdrs, char **strp, uint32_t maxsize); + +#define zdr_array libnfs_zdr_array +bool_t libnfs_zdr_array(ZDR *zdrs, char **arrp, uint32_t *size, uint32_t maxsize, uint32_t elsize, zdrproc_t proc); + +#define zdr_setpos libnfs_zdr_setpos +bool_t libnfs_zdr_setpos(ZDR *zdrs, uint32_t pos); + +#define zdr_getpos libnfs_zdr_getpos +uint32_t libnfs_zdr_getpos(ZDR *zdrs); + +#define zdr_free libnfs_zdr_free +void libnfs_zdr_free(zdrproc_t proc, char *objp); + +#define zdr_callmsg libnfs_zdr_callmsg +bool_t libnfs_zdr_callmsg(ZDR *zdrs, struct rpc_msg *msg); + +#define zdr_replymsg libnfs_zdr_replymsg +bool_t libnfs_zdr_replymsg(ZDR *zdrs, struct rpc_msg *msg); + +#define authnone_create libnfs_authnone_create +AUTH *libnfs_authnone_create(void); + +#define authunix_create libnfs_authunix_create +AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint32_t len, uint32_t *groups); + +#define authunix_create_default libnfs_authunix_create_default +AUTH *libnfs_authunix_create_default(void); + +#define auth_destroy libnfs_auth_destroy +void libnfs_auth_destroy(AUTH *auth); + +#endif diff --git a/include/libnfs.h b/include/libnfs.h index 8621676..3d29631 100644 --- a/include/libnfs.h +++ b/include/libnfs.h @@ -18,8 +18,6 @@ * This is the highlevel interface to access NFS resources using a posix-like interface */ #include -#include -#include struct nfs_context; struct rpc_context; diff --git a/lib/Makefile.am b/lib/Makefile.am index 1f398e2..d0bd7fc 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -12,6 +12,7 @@ libnfs_la_SOURCES = \ init.c \ libnfs.c \ libnfs-sync.c \ + libnfs-zdr.c \ pdu.c \ socket.c diff --git a/lib/init.c b/lib/init.c index 4c8f84f..6bbc11b 100644 --- a/lib/init.c +++ b/lib/init.c @@ -24,9 +24,8 @@ #include #include #include -#include -#include #include "slist.h" +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" diff --git a/lib/libnfs-sync.c b/lib/libnfs-sync.c index 09e197a..737808e 100644 --- a/lib/libnfs-sync.c +++ b/lib/libnfs-sync.c @@ -47,6 +47,7 @@ #include #endif +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-raw-mount.h" diff --git a/lib/libnfs-zdr.c b/lib/libnfs-zdr.c new file mode 100644 index 0000000..315aa0a --- /dev/null +++ b/lib/libnfs-zdr.c @@ -0,0 +1,482 @@ +/* + Copyright (C) 2012 by Ronnie Sahlberg + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see . +*/ +/* + * This file contains definitions for the built in ZDR implementation. + * This is a very limited ZDR subset that can only marshal to/from a momory buffer, + * i.e. zdrmem_create() buffers. + * It aims to be compatible with normal rpcgen generated functions. + */ + +#include +#include +#include "libnfs-zdr.h" + +struct opaque_auth _null_auth; + +bool_t libnfs_zdr_setpos(ZDR *zdrs, uint32_t pos) +{ + zdrs->pos = pos; +} + +uint32_t libnfs_zdr_getpos(ZDR *zdrs) +{ + return zdrs->pos; +} + +void libnfs_zdrmem_create(ZDR *zdrs, const caddr_t addr, uint32_t size, enum zdr_op xop) +{ + zdrs->x_op = xop; + zdrs->buf = addr; + zdrs->size = size; + zdrs->pos = 0; + zdrs->mem = NULL; +} + +static void *zdr_malloc(ZDR *zdrs, uint32_t size) +{ + struct zdr_mem *mem; + + mem = malloc(sizeof(struct zdr_mem)); + mem->next = zdrs->mem; + mem->size = size; + mem->buf = malloc(mem->size); + zdrs->mem = mem; + + return mem->buf; +} + +void libnfs_zdr_destroy(ZDR *zdrs) +{ + while (zdrs->mem != NULL) { + struct zdr_mem *mem = zdrs->mem->next; + free(zdrs->mem->buf); + free(zdrs->mem); + zdrs->mem = mem; + } +} + +bool_t libnfs_zdr_u_int(ZDR *zdrs, uint32_t *u) +{ + if (zdrs->pos + 4 > zdrs->size) { + return FALSE; + } + + switch (zdrs->x_op) { + case ZDR_ENCODE: + *(uint32_t *)&zdrs->buf[zdrs->pos] = htonl(*u); + zdrs->pos += 4; + return TRUE; + break; + case ZDR_DECODE: + *u = ntohl(*(uint32_t *)&zdrs->buf[zdrs->pos]); + zdrs->pos += 4; + return TRUE; + break; + } + + return FALSE; +} + +bool_t libnfs_zdr_int(ZDR *zdrs, int32_t *i) +{ + return libnfs_zdr_u_int(zdrs, (uint32_t *)i); +} + +bool_t libnfs_zdr_u_quad_t(ZDR *zdrs, uint64_t *u) +{ + if (zdrs->pos + 8 > zdrs->size) { + return FALSE; + } + + switch (zdrs->x_op) { + case ZDR_ENCODE: + *(uint32_t *)&zdrs->buf[zdrs->pos] = htonl((*u >> 32)); + zdrs->pos += 4; + *(uint32_t *)&zdrs->buf[zdrs->pos] = htonl((*u & 0xffffffff)); + zdrs->pos += 4; + return TRUE; + break; + case ZDR_DECODE: + *u = ntohl(*(uint32_t *)&zdrs->buf[zdrs->pos]); + zdrs->pos += 4; + *u <<= 32; + *u |= ntohl(*(uint32_t *)&zdrs->buf[zdrs->pos]); + zdrs->pos += 4; + return TRUE; + break; + } + + return FALSE; +} + +bool_t libnfs_zdr_quad_t(ZDR *zdrs, int64_t *i) +{ + return libnfs_zdr_u_quad_t(zdrs, (uint64_t *)i); +} + +bool_t libnfs_zdr_bytes(ZDR *zdrs, char **bufp, uint32_t *size, uint32_t maxsize) +{ + if (!libnfs_zdr_u_int(zdrs, size)) { + return FALSE; + } + + if (zdrs->pos + *size > zdrs->size) { + return FALSE; + } + + switch (zdrs->x_op) { + case ZDR_ENCODE: + memcpy(&zdrs->buf[zdrs->pos], *bufp, *size); + zdrs->pos += *size; + zdrs->pos = (zdrs->pos + 3) & ~3; + return TRUE; + case ZDR_DECODE: + if (*bufp == NULL) { + *bufp = zdr_malloc(zdrs, *size); + } + memcpy(*bufp, &zdrs->buf[zdrs->pos], *size); + zdrs->pos += *size; + zdrs->pos = (zdrs->pos + 3) & ~3; + return TRUE; + } + + return FALSE; +} + + +bool_t libnfs_zdr_enum(ZDR *zdrs, int32_t *e) +{ + return libnfs_zdr_u_int(zdrs, (uint32_t *)e); +} + +bool_t libnfs_zdr_bool(ZDR *zdrs, bool_t *b) +{ + return libnfs_zdr_u_int(zdrs, (uint32_t *)b); +} + +bool_t libnfs_zdr_void(void) +{ + return TRUE; +} + +bool_t libnfs_zdr_pointer(ZDR *zdrs, char **objp, uint32_t size, zdrproc_t proc) +{ + bool_t more_data; + + more_data = (*objp != NULL); + + if (!libnfs_zdr_bool(zdrs, &more_data)) { + return FALSE; + } + if (more_data == 0) { + *objp = NULL; + return TRUE; + } + + if (zdrs->x_op == ZDR_DECODE) { + *objp = zdr_malloc(zdrs, size); + if (*objp == NULL) { + return FALSE; + } + memset(*objp, 0, size); + } + return proc(zdrs, *objp); +} + +bool_t libnfs_zdr_opaque(ZDR *zdrs, char *objp, uint32_t size) +{ + switch (zdrs->x_op) { + case ZDR_ENCODE: + memcpy(&zdrs->buf[zdrs->pos], objp, size); + zdrs->pos += size; + zdrs->pos = (zdrs->pos + 3) & ~3; + return TRUE; + case ZDR_DECODE: + memcpy(objp, &zdrs->buf[zdrs->pos], size); + zdrs->pos += size; + zdrs->pos = (zdrs->pos + 3) & ~3; + return TRUE; + } + + return FALSE; +} + +bool_t libnfs_zdr_string(ZDR *zdrs, char **strp, uint32_t maxsize) +{ + uint32_t size; + + if (zdrs->x_op == ZDR_ENCODE) { + size = strlen(*strp); + } + + if (!libnfs_zdr_u_int(zdrs, &size)) { + return FALSE; + } + + if (zdrs->pos + size > zdrs->size) { + return FALSE; + } + + switch (zdrs->x_op) { + case ZDR_ENCODE: + return libnfs_zdr_opaque(zdrs, *strp, size); + case ZDR_DECODE: + *strp = zdr_malloc(zdrs, size + 1); + if (*strp == NULL) { + return FALSE; + } + (*strp)[size] = 0; + return libnfs_zdr_opaque(zdrs, *strp, size); + } + + return FALSE; +} + +bool_t libnfs_zdr_array(ZDR *zdrs, char **arrp, uint32_t *size, uint32_t maxsize, uint32_t elsize, zdrproc_t proc) +{ + int i; + + if (!libnfs_zdr_u_int(zdrs, size)) { + return FALSE; + } + + if (zdrs->pos + *size * elsize > zdrs->size) { + return FALSE; + } + + if (zdrs->x_op == ZDR_DECODE) { + *arrp = zdr_malloc(zdrs, *size * elsize); + if (*arrp == NULL) { + return FALSE; + } + memset(*arrp, 0, *size * elsize); + } + + for (i = 0; i < *size; i++) { + if (proc(zdrs, *arrp + i * elsize)) { + return FALSE; + } + } + return TRUE; +} + +void libnfs_zdr_free(zdrproc_t proc, char *objp) +{ +} + +static bool_t libnfs_opaque_auth(ZDR *zdrs, struct opaque_auth *auth) +{ + if (!libnfs_zdr_u_int(zdrs, &auth->oa_flavor)) { + return FALSE; + } + + if (!libnfs_zdr_bytes(zdrs, &auth->oa_base, &auth->oa_length, &auth->oa_length)) { + return FALSE; + } + + return TRUE; +} + +static bool_t libnfs_rpc_call_body(ZDR *zdrs, struct call_body *cmb) +{ + if (!libnfs_zdr_u_int(zdrs, &cmb->cb_rpcvers)) { + return FALSE; + } + + if (!libnfs_zdr_u_int(zdrs, &cmb->cb_prog)) { + return FALSE; + } + + if (!libnfs_zdr_u_int(zdrs, &cmb->cb_vers)) { + return FALSE; + } + + if (!libnfs_zdr_u_int(zdrs, &cmb->cb_proc)) { + return FALSE; + } + + if (!libnfs_opaque_auth(zdrs, &cmb->cb_cred)) { + return FALSE; + } + + if (!libnfs_opaque_auth(zdrs, &cmb->cb_verf)) { + return FALSE; + } +} + +static bool_t libnfs_accepted_reply(ZDR *zdrs, struct accepted_reply *ar) +{ + if (!libnfs_opaque_auth(zdrs, &ar->ar_verf)) { + return FALSE; + } + + if (!libnfs_zdr_u_int(zdrs, &ar->ar_stat)) { + return FALSE; + } + + switch (ar->ar_stat) { + case SUCCESS: + if (!ar->ar_results.proc(zdrs, ar->ar_results.where)) { + return FALSE; + } + return TRUE; + case PROG_MISMATCH: + if (!libnfs_zdr_u_int(zdrs, &ar->ar_vers.low)) { + return FALSE; + } + if (!libnfs_zdr_u_int(zdrs, &ar->ar_vers.high)) { + return FALSE; + } + return TRUE; + default: + return TRUE; + } + + return FALSE; +} + +static bool_t libnfs_rejected_reply(ZDR *zdrs, struct rejected_reply *RP_dr) +{ +printf("rejected reply\n"); +exit(10); +} + +static bool_t libnfs_rpc_reply_body(ZDR *zdrs, struct reply_body *rmb) +{ + if (!libnfs_zdr_u_int(zdrs, &rmb->rp_stat)) { + return FALSE; + } + + switch (rmb->rp_stat) { + case MSG_ACCEPTED: + if (!libnfs_accepted_reply(zdrs, &rmb->rp_acpt)) { + return FALSE; + } + return TRUE; + case MSG_DENIED: + if (!libnfs_rejected_reply(zdrs, &rmb->rp_rjct)) { + return FALSE; + } + return TRUE; + } + + return FALSE; +} + +static bool_t libnfs_rpc_msg(ZDR *zdrs, struct rpc_msg *msg) +{ + if (!libnfs_zdr_u_int(zdrs, &msg->rm_xid)) { + return FALSE; + } + + if (!libnfs_zdr_u_int(zdrs, &msg->rm_direction)) { + return FALSE; + } + + switch (msg->rm_direction) { + case CALL: + return libnfs_rpc_call_body(zdrs, &msg->ru.RM_cmb); + break; + case REPLY: + return libnfs_rpc_reply_body(zdrs, &msg->ru.RM_rmb); + break; + default: + return FALSE; + } +} + +bool_t libnfs_zdr_callmsg(ZDR *zdrs, struct rpc_msg *msg) +{ + return libnfs_rpc_msg(zdrs, msg); +} + +bool_t libnfs_zdr_replymsg(ZDR *zdrs, struct rpc_msg *msg) +{ + return libnfs_rpc_msg(zdrs, msg); +} + +AUTH *authnone_create(void) +{ + AUTH *auth; + + auth = malloc(sizeof(AUTH)); + + auth->ah_cred.oa_flavor = AUTH_NONE; + auth->ah_cred.oa_length = 0; + auth->ah_cred.oa_base = NULL; + + auth->ah_verf.oa_flavor = AUTH_NONE; + auth->ah_verf.oa_length = 0; + auth->ah_verf.oa_base = NULL; + + auth->ah_private = NULL; + + return auth; +} + +AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint32_t len, uint32_t *groups) +{ + AUTH *auth; + int size; + uint32_t *buf; + int idx; + + size = 4 + 4 + ((strlen(host) + 3) & ~3) + 4 + 4 + 4 + len * 4; + auth = malloc(sizeof(AUTH)); + auth->ah_cred.oa_flavor = AUTH_UNIX; + auth->ah_cred.oa_length = size; + auth->ah_cred.oa_base = malloc(size); + + buf = auth->ah_cred.oa_base; + idx = 0; + buf[idx++] = htonl(time(NULL)); + buf[idx++] = htonl(strlen(host)); + memcpy(&buf[2], host, strlen(host)); + + idx += (strlen(host) + 3) >> 2; + buf[idx++] = htonl(uid); + buf[idx++] = htonl(gid); + buf[idx++] = htonl(len); + while (len-- > 0) { + buf[idx++] = htonl(*groups++); + } + + auth->ah_verf.oa_flavor = AUTH_NONE; + auth->ah_verf.oa_length = 0; + auth->ah_verf.oa_base = NULL; + + auth->ah_private = NULL; + + return auth; +} + +AUTH *libnfs_authunix_create_default(void) +{ + return libnfs_authunix_create("libnfs", getuid(), -1, 0, NULL); +} + +void libnfs_auth_destroy(AUTH *auth) +{ + if (auth->ah_cred.oa_base) { + free(auth->ah_cred.oa_base); + } + if (auth->ah_verf.oa_base) { + free(auth->ah_verf.oa_base); + } + free(auth); +} + diff --git a/lib/libnfs.c b/lib/libnfs.c index 86ff7c2..5754bfb 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-raw-mount.h" @@ -3341,7 +3343,7 @@ uint64_t nfs_get_readmax(struct nfs_context *nfs) */ uint64_t nfs_get_writemax(struct nfs_context *nfs) { - /* Some XDR libraries can not marshall PDUs bigger than this */ + /* Some ZDR libraries can not marshall PDUs bigger than this */ if (nfs->writemax < 32768) { return nfs->writemax; } diff --git a/lib/pdu.c b/lib/pdu.c index 276515e..1a9547f 100644 --- a/lib/pdu.c +++ b/lib/pdu.c @@ -25,16 +25,17 @@ #include #include +#include +#include +#include #include -#include -#include -#include #include "slist.h" +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" -struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int version, int procedure, rpc_cb cb, void *private_data, xdrproc_t xdr_decode_fn, int xdr_decode_bufsize) +struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int version, int procedure, rpc_cb cb, void *private_data, zdrproc_t zdr_decode_fn, int zdr_decode_bufsize) { struct rpc_pdu *pdu; struct rpc_msg msg; @@ -52,12 +53,12 @@ struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int versi pdu->xid = rpc->xid++; pdu->cb = cb; pdu->private_data = private_data; - pdu->xdr_decode_fn = xdr_decode_fn; - pdu->xdr_decode_bufsize = xdr_decode_bufsize; + pdu->zdr_decode_fn = zdr_decode_fn; + pdu->zdr_decode_bufsize = zdr_decode_bufsize; - xdrmem_create(&pdu->xdr, rpc->encodebuf, rpc->encodebuflen, XDR_ENCODE); + zdrmem_create(&pdu->zdr, rpc->encodebuf, rpc->encodebuflen, ZDR_ENCODE); if (rpc->is_udp == 0) { - xdr_setpos(&pdu->xdr, 4); /* skip past the record marker */ + zdr_setpos(&pdu->zdr, 4); /* skip past the record marker */ } memset(&msg, 0, sizeof(struct rpc_msg)); @@ -70,9 +71,9 @@ struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int versi msg.rm_call.cb_cred = rpc->auth->ah_cred; msg.rm_call.cb_verf = rpc->auth->ah_verf; - if (xdr_callmsg(&pdu->xdr, &msg) == 0) { - rpc_set_error(rpc, "xdr_callmsg failed"); - xdr_destroy(&pdu->xdr); + if (zdr_callmsg(&pdu->zdr, &msg) == 0) { + rpc_set_error(rpc, "zdr_callmsg failed"); + zdr_destroy(&pdu->zdr); free(pdu); return NULL; } @@ -87,13 +88,13 @@ void rpc_free_pdu(struct rpc_context *rpc _U_, struct rpc_pdu *pdu) pdu->outdata.data = NULL; } - if (pdu->xdr_decode_buf != NULL) { - xdr_free(pdu->xdr_decode_fn, pdu->xdr_decode_buf); - free(pdu->xdr_decode_buf); - pdu->xdr_decode_buf = NULL; + if (pdu->zdr_decode_buf != NULL) { + zdr_free(pdu->zdr_decode_fn, pdu->zdr_decode_buf); + free(pdu->zdr_decode_buf); + pdu->zdr_decode_buf = NULL; } - xdr_destroy(&pdu->xdr); + zdr_destroy(&pdu->zdr); free(pdu); } @@ -103,10 +104,11 @@ int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu) { int size, recordmarker; - size = xdr_getpos(&pdu->xdr); + size = zdr_getpos(&pdu->zdr); /* for udp we dont queue, we just send it straight away */ if (rpc->is_udp != 0) { +// XXX add a rpc->udp_dest_sock_size and get rid of sys/socket.h and netinet/in.h if (sendto(rpc->fd, rpc->encodebuf, size, MSG_DONTWAIT, rpc->udp_dest, sizeof(struct sockaddr_in)) < 0) { rpc_set_error(rpc, "Sendto failed with errno %s", strerror(errno)); rpc_free_pdu(rpc, pdu); @@ -117,9 +119,9 @@ int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu) } /* write recordmarker */ - xdr_setpos(&pdu->xdr, 0); + zdr_setpos(&pdu->zdr, 0); recordmarker = (size - 4) | 0x80000000; - xdr_int(&pdu->xdr, &recordmarker); + zdr_int(&pdu->zdr, &recordmarker); pdu->outdata.size = size; pdu->outdata.data = malloc(pdu->outdata.size); @@ -144,33 +146,33 @@ int rpc_get_pdu_size(char *buf) return (size & 0x7fffffff) + 4; } -static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR *xdr) +static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, ZDR *zdr) { struct rpc_msg msg; memset(&msg, 0, sizeof(struct rpc_msg)); msg.acpted_rply.ar_verf = _null_auth; - if (pdu->xdr_decode_bufsize > 0) { - if (pdu->xdr_decode_buf != NULL) { - free(pdu->xdr_decode_buf); + if (pdu->zdr_decode_bufsize > 0) { + if (pdu->zdr_decode_buf != NULL) { + free(pdu->zdr_decode_buf); } - pdu->xdr_decode_buf = malloc(pdu->xdr_decode_bufsize); - if (pdu->xdr_decode_buf == NULL) { - rpc_set_error(rpc, "xdr_replymsg failed in portmap_getport_reply"); - pdu->cb(rpc, RPC_STATUS_ERROR, "Failed to allocate buffer for decoding of XDR reply", pdu->private_data); + pdu->zdr_decode_buf = malloc(pdu->zdr_decode_bufsize); + if (pdu->zdr_decode_buf == NULL) { + rpc_set_error(rpc, "zdr_replymsg failed in portmap_getport_reply"); + pdu->cb(rpc, RPC_STATUS_ERROR, "Failed to allocate buffer for decoding of ZDR reply", pdu->private_data); return 0; } - memset(pdu->xdr_decode_buf, 0, pdu->xdr_decode_bufsize); + memset(pdu->zdr_decode_buf, 0, pdu->zdr_decode_bufsize); } - msg.acpted_rply.ar_results.where = pdu->xdr_decode_buf; - msg.acpted_rply.ar_results.proc = pdu->xdr_decode_fn; + msg.acpted_rply.ar_results.where = pdu->zdr_decode_buf; + msg.acpted_rply.ar_results.proc = pdu->zdr_decode_fn; - if (xdr_replymsg(xdr, &msg) == 0) { - rpc_set_error(rpc, "xdr_replymsg failed in portmap_getport_reply"); + if (zdr_replymsg(zdr, &msg) == 0) { + rpc_set_error(rpc, "zdr_replymsg failed in portmap_getport_reply"); pdu->cb(rpc, RPC_STATUS_ERROR, "Message rejected by server", pdu->private_data); - if (pdu->xdr_decode_buf != NULL) { - free(pdu->xdr_decode_buf); - pdu->xdr_decode_buf = NULL; + if (pdu->zdr_decode_buf != NULL) { + free(pdu->zdr_decode_buf); + pdu->zdr_decode_buf = NULL; } return 0; } @@ -180,7 +182,7 @@ static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR * } switch (msg.rm_reply.rp_acpt.ar_stat) { case SUCCESS: - pdu->cb(rpc, RPC_STATUS_SUCCESS, pdu->xdr_decode_buf, pdu->private_data); + pdu->cb(rpc, RPC_STATUS_SUCCESS, pdu->zdr_decode_buf, pdu->private_data); break; case PROG_UNAVAIL: pdu->cb(rpc, RPC_STATUS_ERROR, "Server responded: Program not available", pdu->private_data); @@ -208,22 +210,22 @@ static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR * int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size) { struct rpc_pdu *pdu; - XDR xdr; + ZDR zdr; int pos, recordmarker = 0; unsigned int xid; char *reasbuf = NULL; - memset(&xdr, 0, sizeof(XDR)); + memset(&zdr, 0, sizeof(ZDR)); - xdrmem_create(&xdr, buf, size, XDR_DECODE); + zdrmem_create(&zdr, buf, size, ZDR_DECODE); if (rpc->is_udp == 0) { - if (xdr_int(&xdr, &recordmarker) == 0) { - rpc_set_error(rpc, "xdr_int reading recordmarker failed"); - xdr_destroy(&xdr); + if (zdr_int(&zdr, &recordmarker) == 0) { + rpc_set_error(rpc, "zdr_int reading recordmarker failed"); + zdr_destroy(&zdr); return -1; } if (!(recordmarker&0x80000000)) { - xdr_destroy(&xdr); + zdr_destroy(&zdr); if (rpc_add_fragment(rpc, buf+4, size-4) != 0) { rpc_set_error(rpc, "Failed to queue fragment for reassembly."); return -1; @@ -238,7 +240,7 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size) uint64_t total = size - 4; char *ptr; - xdr_destroy(&xdr); + zdr_destroy(&zdr); for (fragment = rpc->fragments; fragment; fragment = fragment->next) { total += fragment->size; } @@ -255,20 +257,20 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size) ptr += fragment->size; } memcpy(ptr, buf + 4, size - 4); - xdrmem_create(&xdr, reasbuf, total, XDR_DECODE); + zdrmem_create(&zdr, reasbuf, total, ZDR_DECODE); rpc_free_all_fragments(rpc); } - pos = xdr_getpos(&xdr); - if (xdr_int(&xdr, (int *)&xid) == 0) { - rpc_set_error(rpc, "xdr_int reading xid failed"); - xdr_destroy(&xdr); + pos = zdr_getpos(&zdr); + if (zdr_int(&zdr, (int *)&xid) == 0) { + rpc_set_error(rpc, "zdr_int reading xid failed"); + zdr_destroy(&zdr); if (reasbuf != NULL) { free(reasbuf); } return -1; } - xdr_setpos(&xdr, pos); + zdr_setpos(&zdr, pos); for (pdu=rpc->waitpdu; pdu; pdu=pdu->next) { if (pdu->xid != xid) { @@ -277,10 +279,10 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size) if (rpc->is_udp == 0 || rpc->is_broadcast == 0) { SLIST_REMOVE(&rpc->waitpdu, pdu); } - if (rpc_process_reply(rpc, pdu, &xdr) != 0) { + if (rpc_process_reply(rpc, pdu, &zdr) != 0) { rpc_set_error(rpc, "rpc_procdess_reply failed"); } - xdr_destroy(&xdr); + zdr_destroy(&zdr); if (rpc->is_udp == 0 || rpc->is_broadcast == 0) { rpc_free_pdu(rpc, pdu); } @@ -290,7 +292,7 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size) return 0; } rpc_set_error(rpc, "No matching pdu found for xid:%d", xid); - xdr_destroy(&xdr); + zdr_destroy(&zdr); if (reasbuf != NULL) { free(reasbuf); } diff --git a/lib/socket.c b/lib/socket.c index ea16d8c..360e511 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -33,8 +33,6 @@ #include #include #include -#include -#include #ifdef HAVE_SYS_FILIO_H #include #endif @@ -42,6 +40,7 @@ #include #endif #include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" diff --git a/mount/Makefile.am b/mount/Makefile.am index 19cbaee..b14568a 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libmount.la -mount_SOURCES_GENERATED = libnfs-raw-mount.c -mount_HEADERS_GENERATED = libnfs-raw-mount.h +mount_SOURCES_GENERATED = +mount_HEADERS_GENERATED = mount_GENERATED = $(mount_SOURCES_GENERATED) $(mount_HEADERS_GENERATED) CLEANFILES = $(mount_GENERATED) mount-stamp @@ -9,12 +9,13 @@ CLEANFILES = $(mount_GENERATED) mount-stamp libmount_la_CPPFLAGS = -I$(abs_top_srcdir)/include libmount_la_SOURCES = \ $(mount_SOURCES_GENERATED) \ - mount.c + mount.c libnfs-raw-mount.c $(mount_GENERATED) : mount-stamp mount-stamp : mount.x rm -f $(mount_GENERATED) - rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-mount.h - rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*mount.h\"/#include \"libnfs-raw-mount.h\"/" > libnfs-raw-mount.c touch mount-stamp - + +compile_rpc: + rpcgen -h @RPCGENFLAGS@ mount.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-mount.h + rpcgen -c @RPCGENFLAGS@ mount.x | sed -e "s/#include \".*mount.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-mount.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-mount.c \ No newline at end of file diff --git a/mount/libnfs-raw-mount.c b/mount/libnfs-raw-mount.c new file mode 100644 index 0000000..75bdc21 --- /dev/null +++ b/mount/libnfs-raw-mount.c @@ -0,0 +1,196 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "libnfs-zdr.h" +#include "libnfs-raw-mount.h" + +bool_t +zdr_fhandle3 (ZDR *zdrs, fhandle3 *objp) +{ + register int32_t *buf; + + if (!zdr_bytes (zdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3)) + return FALSE; + return TRUE; +} + +bool_t +zdr_dirpath (ZDR *zdrs, dirpath *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, objp, MNTPATHLEN)) + return FALSE; + return TRUE; +} + +bool_t +zdr_name (ZDR *zdrs, name *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, objp, MNTNAMLEN)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mountstat3 (ZDR *zdrs, mountstat3 *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mountlist (ZDR *zdrs, mountlist *objp) +{ + register int32_t *buf; + + if (!zdr_pointer (zdrs, (char **)objp, sizeof (struct mountbody), (zdrproc_t) zdr_mountbody)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mountbody (ZDR *zdrs, mountbody *objp) +{ + register int32_t *buf; + + if (!zdr_name (zdrs, &objp->ml_hostname)) + return FALSE; + if (!zdr_dirpath (zdrs, &objp->ml_directory)) + return FALSE; + if (!zdr_mountlist (zdrs, &objp->ml_next)) + return FALSE; + return TRUE; +} + +bool_t +zdr_groups (ZDR *zdrs, groups *objp) +{ + register int32_t *buf; + + if (!zdr_pointer (zdrs, (char **)objp, sizeof (struct groupnode), (zdrproc_t) zdr_groupnode)) + return FALSE; + return TRUE; +} + +bool_t +zdr_groupnode (ZDR *zdrs, groupnode *objp) +{ + register int32_t *buf; + + if (!zdr_name (zdrs, &objp->gr_name)) + return FALSE; + if (!zdr_groups (zdrs, &objp->gr_next)) + return FALSE; + return TRUE; +} + +bool_t +zdr_exports (ZDR *zdrs, exports *objp) +{ + register int32_t *buf; + + if (!zdr_pointer (zdrs, (char **)objp, sizeof (struct exportnode), (zdrproc_t) zdr_exportnode)) + return FALSE; + return TRUE; +} + +bool_t +zdr_exportnode (ZDR *zdrs, exportnode *objp) +{ + register int32_t *buf; + + if (!zdr_dirpath (zdrs, &objp->ex_dir)) + return FALSE; + if (!zdr_groups (zdrs, &objp->ex_groups)) + return FALSE; + if (!zdr_exports (zdrs, &objp->ex_next)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mountres3_ok (ZDR *zdrs, mountres3_ok *objp) +{ + register int32_t *buf; + + if (!zdr_fhandle3 (zdrs, &objp->fhandle)) + return FALSE; + if (!zdr_array (zdrs, (char **)&objp->auth_flavors.auth_flavors_val, (u_int *) &objp->auth_flavors.auth_flavors_len, ~0, + sizeof (int), (zdrproc_t) zdr_int)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mountres3 (ZDR *zdrs, mountres3 *objp) +{ + register int32_t *buf; + + if (!zdr_mountstat3 (zdrs, &objp->fhs_status)) + return FALSE; + switch (objp->fhs_status) { + case MNT3_OK: + if (!zdr_mountres3_ok (zdrs, &objp->mountres3_u.mountinfo)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_mountstat1 (ZDR *zdrs, mountstat1 *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_fhandle1 (ZDR *zdrs, fhandle1 objp) +{ + register int32_t *buf; + + if (!zdr_opaque (zdrs, objp, FHSIZE)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mountres1_ok (ZDR *zdrs, mountres1_ok *objp) +{ + register int32_t *buf; + + if (!zdr_fhandle1 (zdrs, objp->fhandle)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mountres1 (ZDR *zdrs, mountres1 *objp) +{ + register int32_t *buf; + + if (!zdr_mountstat1 (zdrs, &objp->fhs_status)) + return FALSE; + switch (objp->fhs_status) { + case MNT1_OK: + if (!zdr_mountres1_ok (zdrs, &objp->mountres1_u.mountinfo)) + return FALSE; + break; + default: + break; + } + return TRUE; +} diff --git a/mount/libnfs-raw-mount.h b/mount/libnfs-raw-mount.h new file mode 100644 index 0000000..23900ab --- /dev/null +++ b/mount/libnfs-raw-mount.h @@ -0,0 +1,250 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _MOUNT_H_RPCGEN +#define _MOUNT_H_RPCGEN + + + + +#ifdef __cplusplus +extern "C" { +#endif + +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 +#define FHSIZE3 64 + +typedef struct { + u_int fhandle3_len; + char *fhandle3_val; +} fhandle3; + +typedef char *dirpath; + +typedef char *name; + +enum mountstat3 { + MNT3_OK = 0, + MNT3ERR_PERM = 1, + MNT3ERR_NOENT = 2, + MNT3ERR_IO = 5, + MNT3ERR_ACCES = 13, + MNT3ERR_NOTDIR = 20, + MNT3ERR_INVAL = 22, + MNT3ERR_NAMETOOLONG = 63, + MNT3ERR_NOTSUPP = 10004, + MNT3ERR_SERVERFAULT = 10006, +}; +typedef enum mountstat3 mountstat3; + +typedef struct mountbody *mountlist; + +struct mountbody { + name ml_hostname; + dirpath ml_directory; + mountlist ml_next; +}; +typedef struct mountbody mountbody; + +typedef struct groupnode *groups; + +struct groupnode { + name gr_name; + groups gr_next; +}; +typedef struct groupnode groupnode; + +typedef struct exportnode *exports; + +struct exportnode { + dirpath ex_dir; + groups ex_groups; + exports ex_next; +}; +typedef struct exportnode exportnode; + +struct mountres3_ok { + fhandle3 fhandle; + struct { + u_int auth_flavors_len; + int *auth_flavors_val; + } auth_flavors; +}; +typedef struct mountres3_ok mountres3_ok; + +struct mountres3 { + mountstat3 fhs_status; + union { + mountres3_ok mountinfo; + } mountres3_u; +}; +typedef struct mountres3 mountres3; + +enum mountstat1 { + MNT1_OK = 0, + MNT1ERR_PERM = 1, + MNT1ERR_NOENT = 2, + MNT1ERR_IO = 5, + MNT1ERR_ACCES = 13, + MNT1ERR_NOTDIR = 20, + MNT1ERR_INVAL = 22, + MNT1ERR_NAMETOOLONG = 63, + MNT1ERR_NOTSUPP = 10004, + MNT1ERR_SERVERFAULT = 10006, +}; +typedef enum mountstat1 mountstat1; +#define FHSIZE 32 + +typedef char fhandle1[FHSIZE]; + +struct mountres1_ok { + fhandle1 fhandle; +}; +typedef struct mountres1_ok mountres1_ok; + +struct mountres1 { + mountstat1 fhs_status; + union { + mountres1_ok mountinfo; + } mountres1_u; +}; +typedef struct mountres1 mountres1; + +#define MOUNT_PROGRAM 100005 +#define MOUNT_V1 1 + +#if defined(__STDC__) || defined(__cplusplus) +#define MOUNT1_NULL 0 +extern void * mount1_null_1(void *, CLIENT *); +extern void * mount1_null_1_svc(void *, struct svc_req *); +#define MOUNT1_MNT 1 +extern mountres1 * mount1_mnt_1(dirpath *, CLIENT *); +extern mountres1 * mount1_mnt_1_svc(dirpath *, struct svc_req *); +#define MOUNT1_DUMP 2 +extern mountlist * mount1_dump_1(void *, CLIENT *); +extern mountlist * mount1_dump_1_svc(void *, struct svc_req *); +#define MOUNT1_UMNT 3 +extern void * mount1_umnt_1(dirpath *, CLIENT *); +extern void * mount1_umnt_1_svc(dirpath *, struct svc_req *); +#define MOUNT1_UMNTALL 4 +extern void * mount1_umntall_1(void *, CLIENT *); +extern void * mount1_umntall_1_svc(void *, struct svc_req *); +#define MOUNT1_EXPORT 5 +extern exports * mount1_export_1(void *, CLIENT *); +extern exports * mount1_export_1_svc(void *, struct svc_req *); +extern int mount_program_1_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define MOUNT1_NULL 0 +extern void * mount1_null_1(); +extern void * mount1_null_1_svc(); +#define MOUNT1_MNT 1 +extern mountres1 * mount1_mnt_1(); +extern mountres1 * mount1_mnt_1_svc(); +#define MOUNT1_DUMP 2 +extern mountlist * mount1_dump_1(); +extern mountlist * mount1_dump_1_svc(); +#define MOUNT1_UMNT 3 +extern void * mount1_umnt_1(); +extern void * mount1_umnt_1_svc(); +#define MOUNT1_UMNTALL 4 +extern void * mount1_umntall_1(); +extern void * mount1_umntall_1_svc(); +#define MOUNT1_EXPORT 5 +extern exports * mount1_export_1(); +extern exports * mount1_export_1_svc(); +extern int mount_program_1_freeresult (); +#endif /* K&R C */ +#define MOUNT_V3 3 + +#if defined(__STDC__) || defined(__cplusplus) +#define MOUNT3_NULL 0 +extern void * mount3_null_3(void *, CLIENT *); +extern void * mount3_null_3_svc(void *, struct svc_req *); +#define MOUNT3_MNT 1 +extern mountres3 * mount3_mnt_3(dirpath *, CLIENT *); +extern mountres3 * mount3_mnt_3_svc(dirpath *, struct svc_req *); +#define MOUNT3_DUMP 2 +extern mountlist * mount3_dump_3(void *, CLIENT *); +extern mountlist * mount3_dump_3_svc(void *, struct svc_req *); +#define MOUNT3_UMNT 3 +extern void * mount3_umnt_3(dirpath *, CLIENT *); +extern void * mount3_umnt_3_svc(dirpath *, struct svc_req *); +#define MOUNT3_UMNTALL 4 +extern void * mount3_umntall_3(void *, CLIENT *); +extern void * mount3_umntall_3_svc(void *, struct svc_req *); +#define MOUNT3_EXPORT 5 +extern exports * mount3_export_3(void *, CLIENT *); +extern exports * mount3_export_3_svc(void *, struct svc_req *); +extern int mount_program_3_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define MOUNT3_NULL 0 +extern void * mount3_null_3(); +extern void * mount3_null_3_svc(); +#define MOUNT3_MNT 1 +extern mountres3 * mount3_mnt_3(); +extern mountres3 * mount3_mnt_3_svc(); +#define MOUNT3_DUMP 2 +extern mountlist * mount3_dump_3(); +extern mountlist * mount3_dump_3_svc(); +#define MOUNT3_UMNT 3 +extern void * mount3_umnt_3(); +extern void * mount3_umnt_3_svc(); +#define MOUNT3_UMNTALL 4 +extern void * mount3_umntall_3(); +extern void * mount3_umntall_3_svc(); +#define MOUNT3_EXPORT 5 +extern exports * mount3_export_3(); +extern exports * mount3_export_3_svc(); +extern int mount_program_3_freeresult (); +#endif /* K&R C */ + +/* the zdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t zdr_fhandle3 (ZDR *, fhandle3*); +extern bool_t zdr_dirpath (ZDR *, dirpath*); +extern bool_t zdr_name (ZDR *, name*); +extern bool_t zdr_mountstat3 (ZDR *, mountstat3*); +extern bool_t zdr_mountlist (ZDR *, mountlist*); +extern bool_t zdr_mountbody (ZDR *, mountbody*); +extern bool_t zdr_groups (ZDR *, groups*); +extern bool_t zdr_groupnode (ZDR *, groupnode*); +extern bool_t zdr_exports (ZDR *, exports*); +extern bool_t zdr_exportnode (ZDR *, exportnode*); +extern bool_t zdr_mountres3_ok (ZDR *, mountres3_ok*); +extern bool_t zdr_mountres3 (ZDR *, mountres3*); +extern bool_t zdr_mountstat1 (ZDR *, mountstat1*); +extern bool_t zdr_fhandle1 (ZDR *, fhandle1); +extern bool_t zdr_mountres1_ok (ZDR *, mountres1_ok*); +extern bool_t zdr_mountres1 (ZDR *, mountres1*); + +#else /* K&R C */ +extern bool_t zdr_fhandle3 (); +extern bool_t zdr_dirpath (); +extern bool_t zdr_name (); +extern bool_t zdr_mountstat3 (); +extern bool_t zdr_mountlist (); +extern bool_t zdr_mountbody (); +extern bool_t zdr_groups (); +extern bool_t zdr_groupnode (); +extern bool_t zdr_exports (); +extern bool_t zdr_exportnode (); +extern bool_t zdr_mountres3_ok (); +extern bool_t zdr_mountres3 (); +extern bool_t zdr_mountstat1 (); +extern bool_t zdr_fhandle1 (); +extern bool_t zdr_mountres1_ok (); +extern bool_t zdr_mountres1 (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_MOUNT_H_RPCGEN */ diff --git a/mount/mount.c b/mount/mount.c index c530a68..1f520cd 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -21,8 +21,7 @@ #include #include -#include -#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" @@ -32,7 +31,7 @@ int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_NULL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_NULL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for mount/null call"); return -1; @@ -51,14 +50,14 @@ int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void * { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_MNT, cb, private_data, (xdrproc_t)xdr_mountres3, sizeof(mountres3)); + pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_MNT, cb, private_data, (zdrproc_t)zdr_mountres3, sizeof(mountres3)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for mount/mnt call"); return -1; } - if (xdr_dirpath(&pdu->xdr, &export) == 0) { - rpc_set_error(rpc, "XDR error. Failed to encode mount/mnt call"); + if (zdr_dirpath(&pdu->zdr, &export) == 0) { + rpc_set_error(rpc, "ZDR error. Failed to encode mount/mnt call"); rpc_free_pdu(rpc, pdu); return -1; } @@ -76,7 +75,7 @@ int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_DUMP, cb, private_data, (xdrproc_t)xdr_mountlist, sizeof(mountlist)); + pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_DUMP, cb, private_data, (zdrproc_t)zdr_mountlist, sizeof(mountlist)); if (pdu == NULL) { rpc_set_error(rpc, "Failed to allocate pdu for mount/dump"); return -1; @@ -95,13 +94,13 @@ int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_UMNT, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_UMNT, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Failed to allocate pdu for mount/umnt"); return -1; } - if (xdr_dirpath(&pdu->xdr, &export) == 0) { + if (zdr_dirpath(&pdu->zdr, &export) == 0) { rpc_set_error(rpc, "failed to encode dirpath for mount/umnt"); rpc_free_pdu(rpc, pdu); return -1; @@ -120,7 +119,7 @@ int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_da { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_UMNTALL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_UMNTALL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Failed to allocate pdu for mount/umntall"); return -1; @@ -139,7 +138,7 @@ int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_dat { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_EXPORT, cb, private_data, (xdrproc_t)xdr_exports, sizeof(exports)); + pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_EXPORT, cb, private_data, (zdrproc_t)zdr_exports, sizeof(exports)); if (pdu == NULL) { rpc_set_error(rpc, "Failed to allocate pdu for mount/export"); return -1; diff --git a/nfs/Makefile.am b/nfs/Makefile.am index 5052369..141597d 100644 --- a/nfs/Makefile.am +++ b/nfs/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libnfs.la -nfs_SOURCES_GENERATED = libnfs-raw-nfs.c -nfs_HEADERS_GENERATED = libnfs-raw-nfs.h +nfs_SOURCES_GENERATED = +nfs_HEADERS_GENERATED = nfs_GENERATED = $(nfs_SOURCES_GENERATED) $(nfs_HEADERS_GENERATED) CLEANFILES = $(nfs_GENERATED) nfs-stamp @@ -9,12 +9,13 @@ CLEANFILES = $(nfs_GENERATED) nfs-stamp libnfs_la_CPPFLAGS = -I$(abs_top_srcdir)/include libnfs_la_SOURCES = \ $(nfs_SOURCES_GENERATED) \ - nfs.c nfsacl.c + nfs.c nfsacl.c libnfs-raw-nfs.c $(nfs_GENERATED) : nfs-stamp nfs-stamp : nfs.x rm -f $(nfs_GENERATED) - rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-nfs.h - rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > libnfs-raw-nfs.c touch nfs-stamp - + +compile_rpc: + rpcgen -h @RPCGENFLAGS@ nfs.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-nfs.h + rpcgen -c @RPCGENFLAGS@ nfs.x | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nfs.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-nfs.c diff --git a/nfs/libnfs-raw-nfs.c b/nfs/libnfs-raw-nfs.c new file mode 100644 index 0000000..4d4f1d4 --- /dev/null +++ b/nfs/libnfs-raw-nfs.c @@ -0,0 +1,2093 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "libnfs-zdr.h" +#include "libnfs-raw-nfs.h" + +bool_t +zdr_cookieverf3 (ZDR *zdrs, cookieverf3 objp) +{ + register int32_t *buf; + + if (!zdr_opaque (zdrs, objp, NFS3_COOKIEVERFSIZE)) + return FALSE; + return TRUE; +} + +bool_t +zdr_uint64 (ZDR *zdrs, uint64 *objp) +{ + register int32_t *buf; + + if (!zdr_u_quad_t (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_cookie3 (ZDR *zdrs, cookie3 *objp) +{ + register int32_t *buf; + + if (!zdr_uint64 (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nfs_fh3 (ZDR *zdrs, nfs_fh3 *objp) +{ + register int32_t *buf; + + if (!zdr_bytes (zdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, NFS3_FHSIZE)) + return FALSE; + return TRUE; +} + +bool_t +zdr_filename3 (ZDR *zdrs, filename3 *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, objp, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_diropargs3 (ZDR *zdrs, diropargs3 *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->dir)) + return FALSE; + if (!zdr_filename3 (zdrs, &objp->name)) + return FALSE; + return TRUE; +} + +bool_t +zdr_ftype3 (ZDR *zdrs, ftype3 *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mode3 (ZDR *zdrs, mode3 *objp) +{ + register int32_t *buf; + + if (!zdr_u_int (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_uid3 (ZDR *zdrs, uid3 *objp) +{ + register int32_t *buf; + + if (!zdr_u_int (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_gid3 (ZDR *zdrs, gid3 *objp) +{ + register int32_t *buf; + + if (!zdr_u_int (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_size3 (ZDR *zdrs, size3 *objp) +{ + register int32_t *buf; + + if (!zdr_uint64 (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_fileid3 (ZDR *zdrs, fileid3 *objp) +{ + register int32_t *buf; + + if (!zdr_uint64 (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_specdata3 (ZDR *zdrs, specdata3 *objp) +{ + register int32_t *buf; + + if (!zdr_u_int (zdrs, &objp->specdata1)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->specdata2)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nfstime3 (ZDR *zdrs, nfstime3 *objp) +{ + register int32_t *buf; + + if (!zdr_u_int (zdrs, &objp->seconds)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->nseconds)) + return FALSE; + return TRUE; +} + +bool_t +zdr_fattr3 (ZDR *zdrs, fattr3 *objp) +{ + register int32_t *buf; + + if (!zdr_ftype3 (zdrs, &objp->type)) + return FALSE; + if (!zdr_mode3 (zdrs, &objp->mode)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->nlink)) + return FALSE; + if (!zdr_uid3 (zdrs, &objp->uid)) + return FALSE; + if (!zdr_gid3 (zdrs, &objp->gid)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->size)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->used)) + return FALSE; + if (!zdr_specdata3 (zdrs, &objp->rdev)) + return FALSE; + if (!zdr_uint64 (zdrs, &objp->fsid)) + return FALSE; + if (!zdr_fileid3 (zdrs, &objp->fileid)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->atime)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->mtime)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->ctime)) + return FALSE; + return TRUE; +} + +bool_t +zdr_post_op_attr (ZDR *zdrs, post_op_attr *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->attributes_follow)) + return FALSE; + switch (objp->attributes_follow) { + case TRUE: + if (!zdr_fattr3 (zdrs, &objp->post_op_attr_u.attributes)) + return FALSE; + break; + case FALSE: + break; + default: + return FALSE; + } + return TRUE; +} + +bool_t +zdr_nfsstat3 (ZDR *zdrs, nfsstat3 *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_stable_how (ZDR *zdrs, stable_how *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_offset3 (ZDR *zdrs, offset3 *objp) +{ + register int32_t *buf; + + if (!zdr_uint64 (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_count3 (ZDR *zdrs, count3 *objp) +{ + register int32_t *buf; + + if (!zdr_u_int (zdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_wcc_attr (ZDR *zdrs, wcc_attr *objp) +{ + register int32_t *buf; + + if (!zdr_size3 (zdrs, &objp->size)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->mtime)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->ctime)) + return FALSE; + return TRUE; +} + +bool_t +zdr_pre_op_attr (ZDR *zdrs, pre_op_attr *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->attributes_follow)) + return FALSE; + switch (objp->attributes_follow) { + case TRUE: + if (!zdr_wcc_attr (zdrs, &objp->pre_op_attr_u.attributes)) + return FALSE; + break; + case FALSE: + break; + default: + return FALSE; + } + return TRUE; +} + +bool_t +zdr_wcc_data (ZDR *zdrs, wcc_data *objp) +{ + register int32_t *buf; + + if (!zdr_pre_op_attr (zdrs, &objp->before)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->after)) + return FALSE; + return TRUE; +} + +bool_t +zdr_WRITE3args (ZDR *zdrs, WRITE3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->file)) + return FALSE; + if (!zdr_offset3 (zdrs, &objp->offset)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->count)) + return FALSE; + if (!zdr_stable_how (zdrs, &objp->stable)) + return FALSE; + if (!zdr_bytes (zdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_writeverf3 (ZDR *zdrs, writeverf3 objp) +{ + register int32_t *buf; + + if (!zdr_opaque (zdrs, objp, NFS3_WRITEVERFSIZE)) + return FALSE; + return TRUE; +} + +bool_t +zdr_WRITE3resok (ZDR *zdrs, WRITE3resok *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->file_wcc)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->count)) + return FALSE; + if (!zdr_stable_how (zdrs, &objp->committed)) + return FALSE; + if (!zdr_writeverf3 (zdrs, objp->verf)) + return FALSE; + return TRUE; +} + +bool_t +zdr_WRITE3resfail (ZDR *zdrs, WRITE3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->file_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_WRITE3res (ZDR *zdrs, WRITE3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_WRITE3resok (zdrs, &objp->WRITE3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_WRITE3resfail (zdrs, &objp->WRITE3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_LOOKUP3args (ZDR *zdrs, LOOKUP3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->what)) + return FALSE; + return TRUE; +} + +bool_t +zdr_LOOKUP3resok (ZDR *zdrs, LOOKUP3resok *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->object)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->dir_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_LOOKUP3resfail (ZDR *zdrs, LOOKUP3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->dir_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_LOOKUP3res (ZDR *zdrs, LOOKUP3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_LOOKUP3resok (zdrs, &objp->LOOKUP3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_LOOKUP3resfail (zdrs, &objp->LOOKUP3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_COMMIT3args (ZDR *zdrs, COMMIT3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->file)) + return FALSE; + if (!zdr_offset3 (zdrs, &objp->offset)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->count)) + return FALSE; + return TRUE; +} + +bool_t +zdr_COMMIT3resok (ZDR *zdrs, COMMIT3resok *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->file_wcc)) + return FALSE; + if (!zdr_writeverf3 (zdrs, objp->verf)) + return FALSE; + return TRUE; +} + +bool_t +zdr_COMMIT3resfail (ZDR *zdrs, COMMIT3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->file_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_COMMIT3res (ZDR *zdrs, COMMIT3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_COMMIT3resok (zdrs, &objp->COMMIT3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_COMMIT3resfail (zdrs, &objp->COMMIT3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_ACCESS3args (ZDR *zdrs, ACCESS3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->object)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->access)) + return FALSE; + return TRUE; +} + +bool_t +zdr_ACCESS3resok (ZDR *zdrs, ACCESS3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->access)) + return FALSE; + return TRUE; +} + +bool_t +zdr_ACCESS3resfail (ZDR *zdrs, ACCESS3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_ACCESS3res (ZDR *zdrs, ACCESS3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_ACCESS3resok (zdrs, &objp->ACCESS3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_ACCESS3resfail (zdrs, &objp->ACCESS3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_GETATTR3args (ZDR *zdrs, GETATTR3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->object)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETATTR3resok (ZDR *zdrs, GETATTR3resok *objp) +{ + register int32_t *buf; + + if (!zdr_fattr3 (zdrs, &objp->obj_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETATTR3res (ZDR *zdrs, GETATTR3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_GETATTR3resok (zdrs, &objp->GETATTR3res_u.resok)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_time_how (ZDR *zdrs, time_how *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_set_mode3 (ZDR *zdrs, set_mode3 *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->set_it)) + return FALSE; + switch (objp->set_it) { + case TRUE: + if (!zdr_mode3 (zdrs, &objp->set_mode3_u.mode)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_set_uid3 (ZDR *zdrs, set_uid3 *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->set_it)) + return FALSE; + switch (objp->set_it) { + case TRUE: + if (!zdr_uid3 (zdrs, &objp->set_uid3_u.uid)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_set_gid3 (ZDR *zdrs, set_gid3 *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->set_it)) + return FALSE; + switch (objp->set_it) { + case TRUE: + if (!zdr_gid3 (zdrs, &objp->set_gid3_u.gid)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_set_size3 (ZDR *zdrs, set_size3 *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->set_it)) + return FALSE; + switch (objp->set_it) { + case TRUE: + if (!zdr_size3 (zdrs, &objp->set_size3_u.size)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_set_atime (ZDR *zdrs, set_atime *objp) +{ + register int32_t *buf; + + if (!zdr_time_how (zdrs, &objp->set_it)) + return FALSE; + switch (objp->set_it) { + case SET_TO_CLIENT_TIME: + if (!zdr_nfstime3 (zdrs, &objp->set_atime_u.atime)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_set_mtime (ZDR *zdrs, set_mtime *objp) +{ + register int32_t *buf; + + if (!zdr_time_how (zdrs, &objp->set_it)) + return FALSE; + switch (objp->set_it) { + case SET_TO_CLIENT_TIME: + if (!zdr_nfstime3 (zdrs, &objp->set_mtime_u.mtime)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_sattr3 (ZDR *zdrs, sattr3 *objp) +{ + register int32_t *buf; + + if (!zdr_set_mode3 (zdrs, &objp->mode)) + return FALSE; + if (!zdr_set_uid3 (zdrs, &objp->uid)) + return FALSE; + if (!zdr_set_gid3 (zdrs, &objp->gid)) + return FALSE; + if (!zdr_set_size3 (zdrs, &objp->size)) + return FALSE; + if (!zdr_set_atime (zdrs, &objp->atime)) + return FALSE; + if (!zdr_set_mtime (zdrs, &objp->mtime)) + return FALSE; + return TRUE; +} + +bool_t +zdr_createmode3 (ZDR *zdrs, createmode3 *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_createverf3 (ZDR *zdrs, createverf3 objp) +{ + register int32_t *buf; + + if (!zdr_opaque (zdrs, objp, NFS3_CREATEVERFSIZE)) + return FALSE; + return TRUE; +} + +bool_t +zdr_createhow3 (ZDR *zdrs, createhow3 *objp) +{ + register int32_t *buf; + + if (!zdr_createmode3 (zdrs, &objp->mode)) + return FALSE; + switch (objp->mode) { + case UNCHECKED: + if (!zdr_sattr3 (zdrs, &objp->createhow3_u.obj_attributes)) + return FALSE; + break; + case GUARDED: + if (!zdr_sattr3 (zdrs, &objp->createhow3_u.g_obj_attributes)) + return FALSE; + break; + case EXCLUSIVE: + if (!zdr_createverf3 (zdrs, objp->createhow3_u.verf)) + return FALSE; + break; + default: + return FALSE; + } + return TRUE; +} + +bool_t +zdr_CREATE3args (ZDR *zdrs, CREATE3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->where)) + return FALSE; + if (!zdr_createhow3 (zdrs, &objp->how)) + return FALSE; + return TRUE; +} + +bool_t +zdr_post_op_fh3 (ZDR *zdrs, post_op_fh3 *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->handle_follows)) + return FALSE; + switch (objp->handle_follows) { + case TRUE: + if (!zdr_nfs_fh3 (zdrs, &objp->post_op_fh3_u.handle)) + return FALSE; + break; + case FALSE: + break; + default: + return FALSE; + } + return TRUE; +} + +bool_t +zdr_CREATE3resok (ZDR *zdrs, CREATE3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_fh3 (zdrs, &objp->obj)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_CREATE3resfail (ZDR *zdrs, CREATE3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_CREATE3res (ZDR *zdrs, CREATE3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_CREATE3resok (zdrs, &objp->CREATE3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_CREATE3resfail (zdrs, &objp->CREATE3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_REMOVE3args (ZDR *zdrs, REMOVE3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->object)) + return FALSE; + return TRUE; +} + +bool_t +zdr_REMOVE3resok (ZDR *zdrs, REMOVE3resok *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_REMOVE3resfail (ZDR *zdrs, REMOVE3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_REMOVE3res (ZDR *zdrs, REMOVE3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_REMOVE3resok (zdrs, &objp->REMOVE3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_REMOVE3resfail (zdrs, &objp->REMOVE3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_READ3args (ZDR *zdrs, READ3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->file)) + return FALSE; + if (!zdr_offset3 (zdrs, &objp->offset)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->count)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READ3resok (ZDR *zdrs, READ3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->file_attributes)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->count)) + return FALSE; + if (!zdr_bool (zdrs, &objp->eof)) + return FALSE; + if (!zdr_bytes (zdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READ3resfail (ZDR *zdrs, READ3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->file_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READ3res (ZDR *zdrs, READ3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_READ3resok (zdrs, &objp->READ3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_READ3resfail (zdrs, &objp->READ3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_FSINFO3args (ZDR *zdrs, FSINFO3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->fsroot)) + return FALSE; + return TRUE; +} + +bool_t +zdr_FSINFO3resok (ZDR *zdrs, FSINFO3resok *objp) +{ + register int32_t *buf; + + + if (zdrs->x_op == ZDR_ENCODE) { + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + buf = ZDR_INLINE (zdrs, 7 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->rtmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->rtpref)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->rtmult)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtpref)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtmult)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->dtpref)) + return FALSE; + + } else { + IZDR_PUT_U_LONG(buf, objp->rtmax); + IZDR_PUT_U_LONG(buf, objp->rtpref); + IZDR_PUT_U_LONG(buf, objp->rtmult); + IZDR_PUT_U_LONG(buf, objp->wtmax); + IZDR_PUT_U_LONG(buf, objp->wtpref); + IZDR_PUT_U_LONG(buf, objp->wtmult); + IZDR_PUT_U_LONG(buf, objp->dtpref); + } + if (!zdr_size3 (zdrs, &objp->maxfilesize)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->time_delta)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->properties)) + return FALSE; + return TRUE; + } else if (zdrs->x_op == ZDR_DECODE) { + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + buf = ZDR_INLINE (zdrs, 7 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->rtmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->rtpref)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->rtmult)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtpref)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtmult)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->dtpref)) + return FALSE; + + } else { + objp->rtmax = IZDR_GET_U_LONG(buf); + objp->rtpref = IZDR_GET_U_LONG(buf); + objp->rtmult = IZDR_GET_U_LONG(buf); + objp->wtmax = IZDR_GET_U_LONG(buf); + objp->wtpref = IZDR_GET_U_LONG(buf); + objp->wtmult = IZDR_GET_U_LONG(buf); + objp->dtpref = IZDR_GET_U_LONG(buf); + } + if (!zdr_size3 (zdrs, &objp->maxfilesize)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->time_delta)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->properties)) + return FALSE; + return TRUE; + } + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->rtmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->rtpref)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->rtmult)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtpref)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->wtmult)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->dtpref)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->maxfilesize)) + return FALSE; + if (!zdr_nfstime3 (zdrs, &objp->time_delta)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->properties)) + return FALSE; + return TRUE; +} + +bool_t +zdr_FSINFO3resfail (ZDR *zdrs, FSINFO3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_FSINFO3res (ZDR *zdrs, FSINFO3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_FSINFO3resok (zdrs, &objp->FSINFO3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_FSINFO3resfail (zdrs, &objp->FSINFO3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_FSSTAT3args (ZDR *zdrs, FSSTAT3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->fsroot)) + return FALSE; + return TRUE; +} + +bool_t +zdr_FSSTAT3resok (ZDR *zdrs, FSSTAT3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->tbytes)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->fbytes)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->abytes)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->tfiles)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->ffiles)) + return FALSE; + if (!zdr_size3 (zdrs, &objp->afiles)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->invarsec)) + return FALSE; + return TRUE; +} + +bool_t +zdr_FSSTAT3resfail (ZDR *zdrs, FSSTAT3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_FSSTAT3res (ZDR *zdrs, FSSTAT3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_FSSTAT3resok (zdrs, &objp->FSSTAT3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_FSSTAT3resfail (zdrs, &objp->FSSTAT3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_PATHCONF3args (ZDR *zdrs, PATHCONF3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->object)) + return FALSE; + return TRUE; +} + +bool_t +zdr_PATHCONF3resok (ZDR *zdrs, PATHCONF3resok *objp) +{ + register int32_t *buf; + + + if (zdrs->x_op == ZDR_ENCODE) { + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + buf = ZDR_INLINE (zdrs, 6 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->linkmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->name_max)) + return FALSE; + if (!zdr_bool (zdrs, &objp->no_trunc)) + return FALSE; + if (!zdr_bool (zdrs, &objp->chown_restricted)) + return FALSE; + if (!zdr_bool (zdrs, &objp->case_insensitive)) + return FALSE; + if (!zdr_bool (zdrs, &objp->case_preserving)) + return FALSE; + } else { + IZDR_PUT_U_LONG(buf, objp->linkmax); + IZDR_PUT_U_LONG(buf, objp->name_max); + IZDR_PUT_BOOL(buf, objp->no_trunc); + IZDR_PUT_BOOL(buf, objp->chown_restricted); + IZDR_PUT_BOOL(buf, objp->case_insensitive); + IZDR_PUT_BOOL(buf, objp->case_preserving); + } + return TRUE; + } else if (zdrs->x_op == ZDR_DECODE) { + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + buf = ZDR_INLINE (zdrs, 6 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->linkmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->name_max)) + return FALSE; + if (!zdr_bool (zdrs, &objp->no_trunc)) + return FALSE; + if (!zdr_bool (zdrs, &objp->chown_restricted)) + return FALSE; + if (!zdr_bool (zdrs, &objp->case_insensitive)) + return FALSE; + if (!zdr_bool (zdrs, &objp->case_preserving)) + return FALSE; + } else { + objp->linkmax = IZDR_GET_U_LONG(buf); + objp->name_max = IZDR_GET_U_LONG(buf); + objp->no_trunc = IZDR_GET_BOOL(buf); + objp->chown_restricted = IZDR_GET_BOOL(buf); + objp->case_insensitive = IZDR_GET_BOOL(buf); + objp->case_preserving = IZDR_GET_BOOL(buf); + } + return TRUE; + } + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->linkmax)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->name_max)) + return FALSE; + if (!zdr_bool (zdrs, &objp->no_trunc)) + return FALSE; + if (!zdr_bool (zdrs, &objp->chown_restricted)) + return FALSE; + if (!zdr_bool (zdrs, &objp->case_insensitive)) + return FALSE; + if (!zdr_bool (zdrs, &objp->case_preserving)) + return FALSE; + return TRUE; +} + +bool_t +zdr_PATHCONF3resfail (ZDR *zdrs, PATHCONF3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_PATHCONF3res (ZDR *zdrs, PATHCONF3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_PATHCONF3resok (zdrs, &objp->PATHCONF3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_PATHCONF3resfail (zdrs, &objp->PATHCONF3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_nfspath3 (ZDR *zdrs, nfspath3 *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, objp, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_symlinkdata3 (ZDR *zdrs, symlinkdata3 *objp) +{ + register int32_t *buf; + + if (!zdr_sattr3 (zdrs, &objp->symlink_attributes)) + return FALSE; + if (!zdr_nfspath3 (zdrs, &objp->symlink_data)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SYMLINK3args (ZDR *zdrs, SYMLINK3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->where)) + return FALSE; + if (!zdr_symlinkdata3 (zdrs, &objp->symlink)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SYMLINK3resok (ZDR *zdrs, SYMLINK3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_fh3 (zdrs, &objp->obj)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SYMLINK3resfail (ZDR *zdrs, SYMLINK3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SYMLINK3res (ZDR *zdrs, SYMLINK3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_SYMLINK3resok (zdrs, &objp->SYMLINK3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_SYMLINK3resfail (zdrs, &objp->SYMLINK3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_READLINK3args (ZDR *zdrs, READLINK3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->symlink)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READLINK3resok (ZDR *zdrs, READLINK3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->symlink_attributes)) + return FALSE; + if (!zdr_nfspath3 (zdrs, &objp->data)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READLINK3resfail (ZDR *zdrs, READLINK3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->symlink_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READLINK3res (ZDR *zdrs, READLINK3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_READLINK3resok (zdrs, &objp->READLINK3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_READLINK3resfail (zdrs, &objp->READLINK3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_devicedata3 (ZDR *zdrs, devicedata3 *objp) +{ + register int32_t *buf; + + if (!zdr_sattr3 (zdrs, &objp->dev_attributes)) + return FALSE; + if (!zdr_specdata3 (zdrs, &objp->spec)) + return FALSE; + return TRUE; +} + +bool_t +zdr_mknoddata3 (ZDR *zdrs, mknoddata3 *objp) +{ + register int32_t *buf; + + if (!zdr_ftype3 (zdrs, &objp->type)) + return FALSE; + switch (objp->type) { + case NF3CHR: + if (!zdr_devicedata3 (zdrs, &objp->mknoddata3_u.chr_device)) + return FALSE; + break; + case NF3BLK: + if (!zdr_devicedata3 (zdrs, &objp->mknoddata3_u.blk_device)) + return FALSE; + break; + case NF3SOCK: + if (!zdr_sattr3 (zdrs, &objp->mknoddata3_u.sock_attributes)) + return FALSE; + break; + case NF3FIFO: + if (!zdr_sattr3 (zdrs, &objp->mknoddata3_u.pipe_attributes)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_MKNOD3args (ZDR *zdrs, MKNOD3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->where)) + return FALSE; + if (!zdr_mknoddata3 (zdrs, &objp->what)) + return FALSE; + return TRUE; +} + +bool_t +zdr_MKNOD3resok (ZDR *zdrs, MKNOD3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_fh3 (zdrs, &objp->obj)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_MKNOD3resfail (ZDR *zdrs, MKNOD3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_MKNOD3res (ZDR *zdrs, MKNOD3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_MKNOD3resok (zdrs, &objp->MKNOD3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_MKNOD3resfail (zdrs, &objp->MKNOD3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_MKDIR3args (ZDR *zdrs, MKDIR3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->where)) + return FALSE; + if (!zdr_sattr3 (zdrs, &objp->attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_MKDIR3resok (ZDR *zdrs, MKDIR3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_fh3 (zdrs, &objp->obj)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->obj_attributes)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_MKDIR3resfail (ZDR *zdrs, MKDIR3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_MKDIR3res (ZDR *zdrs, MKDIR3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_MKDIR3resok (zdrs, &objp->MKDIR3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_MKDIR3resfail (zdrs, &objp->MKDIR3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_RMDIR3args (ZDR *zdrs, RMDIR3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->object)) + return FALSE; + return TRUE; +} + +bool_t +zdr_RMDIR3resok (ZDR *zdrs, RMDIR3resok *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_RMDIR3resfail (ZDR *zdrs, RMDIR3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->dir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_RMDIR3res (ZDR *zdrs, RMDIR3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_RMDIR3resok (zdrs, &objp->RMDIR3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_RMDIR3resfail (zdrs, &objp->RMDIR3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_RENAME3args (ZDR *zdrs, RENAME3args *objp) +{ + register int32_t *buf; + + if (!zdr_diropargs3 (zdrs, &objp->from)) + return FALSE; + if (!zdr_diropargs3 (zdrs, &objp->to)) + return FALSE; + return TRUE; +} + +bool_t +zdr_RENAME3resok (ZDR *zdrs, RENAME3resok *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->fromdir_wcc)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->todir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_RENAME3resfail (ZDR *zdrs, RENAME3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->fromdir_wcc)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->todir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_RENAME3res (ZDR *zdrs, RENAME3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_RENAME3resok (zdrs, &objp->RENAME3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_RENAME3resfail (zdrs, &objp->RENAME3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_READDIRPLUS3args (ZDR *zdrs, READDIRPLUS3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->dir)) + return FALSE; + if (!zdr_cookie3 (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_cookieverf3 (zdrs, objp->cookieverf)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->dircount)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->maxcount)) + return FALSE; + return TRUE; +} + +bool_t +zdr_entryplus3 (ZDR *zdrs, entryplus3 *objp) +{ + register int32_t *buf; + + if (!zdr_fileid3 (zdrs, &objp->fileid)) + return FALSE; + if (!zdr_filename3 (zdrs, &objp->name)) + return FALSE; + if (!zdr_cookie3 (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_post_op_attr (zdrs, &objp->name_attributes)) + return FALSE; + if (!zdr_post_op_fh3 (zdrs, &objp->name_handle)) + return FALSE; + if (!zdr_pointer (zdrs, (char **)&objp->nextentry, sizeof (entryplus3), (zdrproc_t) zdr_entryplus3)) + return FALSE; + return TRUE; +} + +bool_t +zdr_dirlistplus3 (ZDR *zdrs, dirlistplus3 *objp) +{ + register int32_t *buf; + + if (!zdr_pointer (zdrs, (char **)&objp->entries, sizeof (entryplus3), (zdrproc_t) zdr_entryplus3)) + return FALSE; + if (!zdr_bool (zdrs, &objp->eof)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READDIRPLUS3resok (ZDR *zdrs, READDIRPLUS3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->dir_attributes)) + return FALSE; + if (!zdr_cookieverf3 (zdrs, objp->cookieverf)) + return FALSE; + if (!zdr_dirlistplus3 (zdrs, &objp->reply)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READDIRPLUS3resfail (ZDR *zdrs, READDIRPLUS3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->dir_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READDIRPLUS3res (ZDR *zdrs, READDIRPLUS3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_READDIRPLUS3resok (zdrs, &objp->READDIRPLUS3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_READDIRPLUS3resfail (zdrs, &objp->READDIRPLUS3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_READDIR3args (ZDR *zdrs, READDIR3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->dir)) + return FALSE; + if (!zdr_cookie3 (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_cookieverf3 (zdrs, objp->cookieverf)) + return FALSE; + if (!zdr_count3 (zdrs, &objp->count)) + return FALSE; + return TRUE; +} + +bool_t +zdr_entry3 (ZDR *zdrs, entry3 *objp) +{ + register int32_t *buf; + + if (!zdr_fileid3 (zdrs, &objp->fileid)) + return FALSE; + if (!zdr_filename3 (zdrs, &objp->name)) + return FALSE; + if (!zdr_cookie3 (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_pointer (zdrs, (char **)&objp->nextentry, sizeof (entry3), (zdrproc_t) zdr_entry3)) + return FALSE; + return TRUE; +} + +bool_t +zdr_dirlist3 (ZDR *zdrs, dirlist3 *objp) +{ + register int32_t *buf; + + if (!zdr_pointer (zdrs, (char **)&objp->entries, sizeof (entry3), (zdrproc_t) zdr_entry3)) + return FALSE; + if (!zdr_bool (zdrs, &objp->eof)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READDIR3resok (ZDR *zdrs, READDIR3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->dir_attributes)) + return FALSE; + if (!zdr_cookieverf3 (zdrs, objp->cookieverf)) + return FALSE; + if (!zdr_dirlist3 (zdrs, &objp->reply)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READDIR3resfail (ZDR *zdrs, READDIR3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->dir_attributes)) + return FALSE; + return TRUE; +} + +bool_t +zdr_READDIR3res (ZDR *zdrs, READDIR3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_READDIR3resok (zdrs, &objp->READDIR3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_READDIR3resfail (zdrs, &objp->READDIR3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_LINK3args (ZDR *zdrs, LINK3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->file)) + return FALSE; + if (!zdr_diropargs3 (zdrs, &objp->link)) + return FALSE; + return TRUE; +} + +bool_t +zdr_LINK3resok (ZDR *zdrs, LINK3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->file_attributes)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->linkdir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_LINK3resfail (ZDR *zdrs, LINK3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->file_attributes)) + return FALSE; + if (!zdr_wcc_data (zdrs, &objp->linkdir_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_LINK3res (ZDR *zdrs, LINK3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_LINK3resok (zdrs, &objp->LINK3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_LINK3resfail (zdrs, &objp->LINK3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_sattrguard3 (ZDR *zdrs, sattrguard3 *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->check)) + return FALSE; + switch (objp->check) { + case TRUE: + if (!zdr_nfstime3 (zdrs, &objp->sattrguard3_u.obj_ctime)) + return FALSE; + break; + case FALSE: + break; + default: + return FALSE; + } + return TRUE; +} + +bool_t +zdr_SETATTR3args (ZDR *zdrs, SETATTR3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->object)) + return FALSE; + if (!zdr_sattr3 (zdrs, &objp->new_attributes)) + return FALSE; + if (!zdr_sattrguard3 (zdrs, &objp->guard)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SETATTR3resok (ZDR *zdrs, SETATTR3resok *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->obj_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SETATTR3resfail (ZDR *zdrs, SETATTR3resfail *objp) +{ + register int32_t *buf; + + if (!zdr_wcc_data (zdrs, &objp->obj_wcc)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SETATTR3res (ZDR *zdrs, SETATTR3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_SETATTR3resok (zdrs, &objp->SETATTR3res_u.resok)) + return FALSE; + break; + default: + if (!zdr_SETATTR3resfail (zdrs, &objp->SETATTR3res_u.resfail)) + return FALSE; + break; + } + return TRUE; +} + +bool_t +zdr_nfsacl_type (ZDR *zdrs, nfsacl_type *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nfsacl_ace (ZDR *zdrs, nfsacl_ace *objp) +{ + register int32_t *buf; + + if (!zdr_nfsacl_type (zdrs, &objp->type)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->id)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->perm)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETACL3args (ZDR *zdrs, GETACL3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->dir)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->mask)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETACL3resok (ZDR *zdrs, GETACL3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->attr)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->mask)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->ace_count)) + return FALSE; + if (!zdr_array (zdrs, (char **)&objp->ace.ace_val, (u_int *) &objp->ace.ace_len, ~0, + sizeof (nfsacl_ace), (zdrproc_t) zdr_nfsacl_ace)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->default_ace_count)) + return FALSE; + if (!zdr_array (zdrs, (char **)&objp->default_ace.default_ace_val, (u_int *) &objp->default_ace.default_ace_len, ~0, + sizeof (nfsacl_ace), (zdrproc_t) zdr_nfsacl_ace)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETACL3res (ZDR *zdrs, GETACL3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_GETACL3resok (zdrs, &objp->GETACL3res_u.resok)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_SETACL3args (ZDR *zdrs, SETACL3args *objp) +{ + register int32_t *buf; + + if (!zdr_nfs_fh3 (zdrs, &objp->dir)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->mask)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->ace_count)) + return FALSE; + if (!zdr_array (zdrs, (char **)&objp->ace.ace_val, (u_int *) &objp->ace.ace_len, ~0, + sizeof (nfsacl_ace), (zdrproc_t) zdr_nfsacl_ace)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->default_ace_count)) + return FALSE; + if (!zdr_array (zdrs, (char **)&objp->default_ace.default_ace_val, (u_int *) &objp->default_ace.default_ace_len, ~0, + sizeof (nfsacl_ace), (zdrproc_t) zdr_nfsacl_ace)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SETACL3resok (ZDR *zdrs, SETACL3resok *objp) +{ + register int32_t *buf; + + if (!zdr_post_op_attr (zdrs, &objp->attr)) + return FALSE; + return TRUE; +} + +bool_t +zdr_SETACL3res (ZDR *zdrs, SETACL3res *objp) +{ + register int32_t *buf; + + if (!zdr_nfsstat3 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NFS3_OK: + if (!zdr_SETACL3resok (zdrs, &objp->SETACL3res_u.resok)) + return FALSE; + break; + default: + break; + } + return TRUE; +} diff --git a/nfs/libnfs-raw-nfs.h b/nfs/libnfs-raw-nfs.h new file mode 100644 index 0000000..c2c2f9a --- /dev/null +++ b/nfs/libnfs-raw-nfs.h @@ -0,0 +1,1455 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _NFS_H_RPCGEN +#define _NFS_H_RPCGEN + + + + +#ifdef __cplusplus +extern "C" { +#endif + +#define NFS3_FHSIZE 64 +#define NFS3_WRITEVERFSIZE 8 +#define NFS3_CREATEVERFSIZE 8 +#define NFS3_COOKIEVERFSIZE 8 + +typedef char cookieverf3[NFS3_COOKIEVERFSIZE]; + +typedef u_quad_t uint64; + +typedef uint64 cookie3; + +struct nfs_fh3 { + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct nfs_fh3 nfs_fh3; + +typedef char *filename3; + +struct diropargs3 { + nfs_fh3 dir; + filename3 name; +}; +typedef struct diropargs3 diropargs3; + +enum ftype3 { + NF3REG = 1, + NF3DIR = 2, + NF3BLK = 3, + NF3CHR = 4, + NF3LNK = 5, + NF3SOCK = 6, + NF3FIFO = 7, +}; +typedef enum ftype3 ftype3; + +typedef u_int mode3; + +typedef u_int uid3; + +typedef u_int gid3; + +typedef uint64 size3; + +typedef uint64 fileid3; + +struct specdata3 { + u_int specdata1; + u_int specdata2; +}; +typedef struct specdata3 specdata3; + +struct nfstime3 { + u_int seconds; + u_int nseconds; +}; +typedef struct nfstime3 nfstime3; + +struct fattr3 { + ftype3 type; + mode3 mode; + u_int nlink; + uid3 uid; + gid3 gid; + size3 size; + size3 used; + specdata3 rdev; + uint64 fsid; + fileid3 fileid; + nfstime3 atime; + nfstime3 mtime; + nfstime3 ctime; +}; +typedef struct fattr3 fattr3; + +struct post_op_attr { + bool_t attributes_follow; + union { + fattr3 attributes; + } post_op_attr_u; +}; +typedef struct post_op_attr post_op_attr; + +enum nfsstat3 { + NFS3_OK = 0, + NFS3ERR_PERM = 1, + NFS3ERR_NOENT = 2, + NFS3ERR_IO = 5, + NFS3ERR_NXIO = 6, + NFS3ERR_ACCES = 13, + NFS3ERR_EXIST = 17, + NFS3ERR_XDEV = 18, + NFS3ERR_NODEV = 19, + NFS3ERR_NOTDIR = 20, + NFS3ERR_ISDIR = 21, + NFS3ERR_INVAL = 22, + NFS3ERR_FBIG = 27, + NFS3ERR_NOSPC = 28, + NFS3ERR_ROFS = 30, + NFS3ERR_MLINK = 31, + NFS3ERR_NAMETOOLONG = 63, + NFS3ERR_NOTEMPTY = 66, + NFS3ERR_DQUOT = 69, + NFS3ERR_STALE = 70, + NFS3ERR_REMOTE = 71, + NFS3ERR_BADHANDLE = 10001, + NFS3ERR_NOT_SYNC = 10002, + NFS3ERR_BAD_COOKIE = 10003, + NFS3ERR_NOTSUPP = 10004, + NFS3ERR_TOOSMALL = 10005, + NFS3ERR_SERVERFAULT = 10006, + NFS3ERR_BADTYPE = 10007, + NFS3ERR_JUKEBOX = 10008, +}; +typedef enum nfsstat3 nfsstat3; + +enum stable_how { + UNSTABLE = 0, + DATA_SYNC = 1, + FILE_SYNC = 2, +}; +typedef enum stable_how stable_how; + +typedef uint64 offset3; + +typedef u_int count3; + +struct wcc_attr { + size3 size; + nfstime3 mtime; + nfstime3 ctime; +}; +typedef struct wcc_attr wcc_attr; + +struct pre_op_attr { + bool_t attributes_follow; + union { + wcc_attr attributes; + } pre_op_attr_u; +}; +typedef struct pre_op_attr pre_op_attr; + +struct wcc_data { + pre_op_attr before; + post_op_attr after; +}; +typedef struct wcc_data wcc_data; + +struct WRITE3args { + nfs_fh3 file; + offset3 offset; + count3 count; + stable_how stable; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct WRITE3args WRITE3args; + +typedef char writeverf3[NFS3_WRITEVERFSIZE]; + +struct WRITE3resok { + wcc_data file_wcc; + count3 count; + stable_how committed; + writeverf3 verf; +}; +typedef struct WRITE3resok WRITE3resok; + +struct WRITE3resfail { + wcc_data file_wcc; +}; +typedef struct WRITE3resfail WRITE3resfail; + +struct WRITE3res { + nfsstat3 status; + union { + WRITE3resok resok; + WRITE3resfail resfail; + } WRITE3res_u; +}; +typedef struct WRITE3res WRITE3res; + +struct LOOKUP3args { + diropargs3 what; +}; +typedef struct LOOKUP3args LOOKUP3args; + +struct LOOKUP3resok { + nfs_fh3 object; + post_op_attr obj_attributes; + post_op_attr dir_attributes; +}; +typedef struct LOOKUP3resok LOOKUP3resok; + +struct LOOKUP3resfail { + post_op_attr dir_attributes; +}; +typedef struct LOOKUP3resfail LOOKUP3resfail; + +struct LOOKUP3res { + nfsstat3 status; + union { + LOOKUP3resok resok; + LOOKUP3resfail resfail; + } LOOKUP3res_u; +}; +typedef struct LOOKUP3res LOOKUP3res; + +struct COMMIT3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; +typedef struct COMMIT3args COMMIT3args; + +struct COMMIT3resok { + wcc_data file_wcc; + writeverf3 verf; +}; +typedef struct COMMIT3resok COMMIT3resok; + +struct COMMIT3resfail { + wcc_data file_wcc; +}; +typedef struct COMMIT3resfail COMMIT3resfail; + +struct COMMIT3res { + nfsstat3 status; + union { + COMMIT3resok resok; + COMMIT3resfail resfail; + } COMMIT3res_u; +}; +typedef struct COMMIT3res COMMIT3res; +#define ACCESS3_READ 0x0001 +#define ACCESS3_LOOKUP 0x0002 +#define ACCESS3_MODIFY 0x0004 +#define ACCESS3_EXTEND 0x0008 +#define ACCESS3_DELETE 0x0010 +#define ACCESS3_EXECUTE 0x0020 + +struct ACCESS3args { + nfs_fh3 object; + u_int access; +}; +typedef struct ACCESS3args ACCESS3args; + +struct ACCESS3resok { + post_op_attr obj_attributes; + u_int access; +}; +typedef struct ACCESS3resok ACCESS3resok; + +struct ACCESS3resfail { + post_op_attr obj_attributes; +}; +typedef struct ACCESS3resfail ACCESS3resfail; + +struct ACCESS3res { + nfsstat3 status; + union { + ACCESS3resok resok; + ACCESS3resfail resfail; + } ACCESS3res_u; +}; +typedef struct ACCESS3res ACCESS3res; + +struct GETATTR3args { + nfs_fh3 object; +}; +typedef struct GETATTR3args GETATTR3args; + +struct GETATTR3resok { + fattr3 obj_attributes; +}; +typedef struct GETATTR3resok GETATTR3resok; + +struct GETATTR3res { + nfsstat3 status; + union { + GETATTR3resok resok; + } GETATTR3res_u; +}; +typedef struct GETATTR3res GETATTR3res; + +enum time_how { + DONT_CHANGE = 0, + SET_TO_SERVER_TIME = 1, + SET_TO_CLIENT_TIME = 2, +}; +typedef enum time_how time_how; + +struct set_mode3 { + bool_t set_it; + union { + mode3 mode; + } set_mode3_u; +}; +typedef struct set_mode3 set_mode3; + +struct set_uid3 { + bool_t set_it; + union { + uid3 uid; + } set_uid3_u; +}; +typedef struct set_uid3 set_uid3; + +struct set_gid3 { + bool_t set_it; + union { + gid3 gid; + } set_gid3_u; +}; +typedef struct set_gid3 set_gid3; + +struct set_size3 { + bool_t set_it; + union { + size3 size; + } set_size3_u; +}; +typedef struct set_size3 set_size3; + +struct set_atime { + time_how set_it; + union { + nfstime3 atime; + } set_atime_u; +}; +typedef struct set_atime set_atime; + +struct set_mtime { + time_how set_it; + union { + nfstime3 mtime; + } set_mtime_u; +}; +typedef struct set_mtime set_mtime; + +struct sattr3 { + set_mode3 mode; + set_uid3 uid; + set_gid3 gid; + set_size3 size; + set_atime atime; + set_mtime mtime; +}; +typedef struct sattr3 sattr3; + +enum createmode3 { + UNCHECKED = 0, + GUARDED = 1, + EXCLUSIVE = 2, +}; +typedef enum createmode3 createmode3; + +typedef char createverf3[NFS3_CREATEVERFSIZE]; + +struct createhow3 { + createmode3 mode; + union { + sattr3 obj_attributes; + sattr3 g_obj_attributes; + createverf3 verf; + } createhow3_u; +}; +typedef struct createhow3 createhow3; + +struct CREATE3args { + diropargs3 where; + createhow3 how; +}; +typedef struct CREATE3args CREATE3args; + +struct post_op_fh3 { + bool_t handle_follows; + union { + nfs_fh3 handle; + } post_op_fh3_u; +}; +typedef struct post_op_fh3 post_op_fh3; + +struct CREATE3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct CREATE3resok CREATE3resok; + +struct CREATE3resfail { + wcc_data dir_wcc; +}; +typedef struct CREATE3resfail CREATE3resfail; + +struct CREATE3res { + nfsstat3 status; + union { + CREATE3resok resok; + CREATE3resfail resfail; + } CREATE3res_u; +}; +typedef struct CREATE3res CREATE3res; + +struct REMOVE3args { + diropargs3 object; +}; +typedef struct REMOVE3args REMOVE3args; + +struct REMOVE3resok { + wcc_data dir_wcc; +}; +typedef struct REMOVE3resok REMOVE3resok; + +struct REMOVE3resfail { + wcc_data dir_wcc; +}; +typedef struct REMOVE3resfail REMOVE3resfail; + +struct REMOVE3res { + nfsstat3 status; + union { + REMOVE3resok resok; + REMOVE3resfail resfail; + } REMOVE3res_u; +}; +typedef struct REMOVE3res REMOVE3res; + +struct READ3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; +typedef struct READ3args READ3args; + +struct READ3resok { + post_op_attr file_attributes; + count3 count; + bool_t eof; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct READ3resok READ3resok; + +struct READ3resfail { + post_op_attr file_attributes; +}; +typedef struct READ3resfail READ3resfail; + +struct READ3res { + nfsstat3 status; + union { + READ3resok resok; + READ3resfail resfail; + } READ3res_u; +}; +typedef struct READ3res READ3res; +#define FSF3_LINK 0x0001 +#define FSF3_SYMLINK 0x0002 +#define FSF3_HOMOGENEOUS 0x0008 +#define FSF3_CANSETTIME 0x0010 + +struct FSINFO3args { + nfs_fh3 fsroot; +}; +typedef struct FSINFO3args FSINFO3args; + +struct FSINFO3resok { + post_op_attr obj_attributes; + u_int rtmax; + u_int rtpref; + u_int rtmult; + u_int wtmax; + u_int wtpref; + u_int wtmult; + u_int dtpref; + size3 maxfilesize; + nfstime3 time_delta; + u_int properties; +}; +typedef struct FSINFO3resok FSINFO3resok; + +struct FSINFO3resfail { + post_op_attr obj_attributes; +}; +typedef struct FSINFO3resfail FSINFO3resfail; + +struct FSINFO3res { + nfsstat3 status; + union { + FSINFO3resok resok; + FSINFO3resfail resfail; + } FSINFO3res_u; +}; +typedef struct FSINFO3res FSINFO3res; + +struct FSSTAT3args { + nfs_fh3 fsroot; +}; +typedef struct FSSTAT3args FSSTAT3args; + +struct FSSTAT3resok { + post_op_attr obj_attributes; + size3 tbytes; + size3 fbytes; + size3 abytes; + size3 tfiles; + size3 ffiles; + size3 afiles; + u_int invarsec; +}; +typedef struct FSSTAT3resok FSSTAT3resok; + +struct FSSTAT3resfail { + post_op_attr obj_attributes; +}; +typedef struct FSSTAT3resfail FSSTAT3resfail; + +struct FSSTAT3res { + nfsstat3 status; + union { + FSSTAT3resok resok; + FSSTAT3resfail resfail; + } FSSTAT3res_u; +}; +typedef struct FSSTAT3res FSSTAT3res; + +struct PATHCONF3args { + nfs_fh3 object; +}; +typedef struct PATHCONF3args PATHCONF3args; + +struct PATHCONF3resok { + post_op_attr obj_attributes; + u_int linkmax; + u_int name_max; + bool_t no_trunc; + bool_t chown_restricted; + bool_t case_insensitive; + bool_t case_preserving; +}; +typedef struct PATHCONF3resok PATHCONF3resok; + +struct PATHCONF3resfail { + post_op_attr obj_attributes; +}; +typedef struct PATHCONF3resfail PATHCONF3resfail; + +struct PATHCONF3res { + nfsstat3 status; + union { + PATHCONF3resok resok; + PATHCONF3resfail resfail; + } PATHCONF3res_u; +}; +typedef struct PATHCONF3res PATHCONF3res; + +typedef char *nfspath3; + +struct symlinkdata3 { + sattr3 symlink_attributes; + nfspath3 symlink_data; +}; +typedef struct symlinkdata3 symlinkdata3; + +struct SYMLINK3args { + diropargs3 where; + symlinkdata3 symlink; +}; +typedef struct SYMLINK3args SYMLINK3args; + +struct SYMLINK3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct SYMLINK3resok SYMLINK3resok; + +struct SYMLINK3resfail { + wcc_data dir_wcc; +}; +typedef struct SYMLINK3resfail SYMLINK3resfail; + +struct SYMLINK3res { + nfsstat3 status; + union { + SYMLINK3resok resok; + SYMLINK3resfail resfail; + } SYMLINK3res_u; +}; +typedef struct SYMLINK3res SYMLINK3res; + +struct READLINK3args { + nfs_fh3 symlink; +}; +typedef struct READLINK3args READLINK3args; + +struct READLINK3resok { + post_op_attr symlink_attributes; + nfspath3 data; +}; +typedef struct READLINK3resok READLINK3resok; + +struct READLINK3resfail { + post_op_attr symlink_attributes; +}; +typedef struct READLINK3resfail READLINK3resfail; + +struct READLINK3res { + nfsstat3 status; + union { + READLINK3resok resok; + READLINK3resfail resfail; + } READLINK3res_u; +}; +typedef struct READLINK3res READLINK3res; + +struct devicedata3 { + sattr3 dev_attributes; + specdata3 spec; +}; +typedef struct devicedata3 devicedata3; + +struct mknoddata3 { + ftype3 type; + union { + devicedata3 chr_device; + devicedata3 blk_device; + sattr3 sock_attributes; + sattr3 pipe_attributes; + } mknoddata3_u; +}; +typedef struct mknoddata3 mknoddata3; + +struct MKNOD3args { + diropargs3 where; + mknoddata3 what; +}; +typedef struct MKNOD3args MKNOD3args; + +struct MKNOD3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct MKNOD3resok MKNOD3resok; + +struct MKNOD3resfail { + wcc_data dir_wcc; +}; +typedef struct MKNOD3resfail MKNOD3resfail; + +struct MKNOD3res { + nfsstat3 status; + union { + MKNOD3resok resok; + MKNOD3resfail resfail; + } MKNOD3res_u; +}; +typedef struct MKNOD3res MKNOD3res; + +struct MKDIR3args { + diropargs3 where; + sattr3 attributes; +}; +typedef struct MKDIR3args MKDIR3args; + +struct MKDIR3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct MKDIR3resok MKDIR3resok; + +struct MKDIR3resfail { + wcc_data dir_wcc; +}; +typedef struct MKDIR3resfail MKDIR3resfail; + +struct MKDIR3res { + nfsstat3 status; + union { + MKDIR3resok resok; + MKDIR3resfail resfail; + } MKDIR3res_u; +}; +typedef struct MKDIR3res MKDIR3res; + +struct RMDIR3args { + diropargs3 object; +}; +typedef struct RMDIR3args RMDIR3args; + +struct RMDIR3resok { + wcc_data dir_wcc; +}; +typedef struct RMDIR3resok RMDIR3resok; + +struct RMDIR3resfail { + wcc_data dir_wcc; +}; +typedef struct RMDIR3resfail RMDIR3resfail; + +struct RMDIR3res { + nfsstat3 status; + union { + RMDIR3resok resok; + RMDIR3resfail resfail; + } RMDIR3res_u; +}; +typedef struct RMDIR3res RMDIR3res; + +struct RENAME3args { + diropargs3 from; + diropargs3 to; +}; +typedef struct RENAME3args RENAME3args; + +struct RENAME3resok { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; +typedef struct RENAME3resok RENAME3resok; + +struct RENAME3resfail { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; +typedef struct RENAME3resfail RENAME3resfail; + +struct RENAME3res { + nfsstat3 status; + union { + RENAME3resok resok; + RENAME3resfail resfail; + } RENAME3res_u; +}; +typedef struct RENAME3res RENAME3res; + +struct READDIRPLUS3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 dircount; + count3 maxcount; +}; +typedef struct READDIRPLUS3args READDIRPLUS3args; + +struct entryplus3 { + fileid3 fileid; + filename3 name; + cookie3 cookie; + post_op_attr name_attributes; + post_op_fh3 name_handle; + struct entryplus3 *nextentry; +}; +typedef struct entryplus3 entryplus3; + +struct dirlistplus3 { + entryplus3 *entries; + bool_t eof; +}; +typedef struct dirlistplus3 dirlistplus3; + +struct READDIRPLUS3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlistplus3 reply; +}; +typedef struct READDIRPLUS3resok READDIRPLUS3resok; + +struct READDIRPLUS3resfail { + post_op_attr dir_attributes; +}; +typedef struct READDIRPLUS3resfail READDIRPLUS3resfail; + +struct READDIRPLUS3res { + nfsstat3 status; + union { + READDIRPLUS3resok resok; + READDIRPLUS3resfail resfail; + } READDIRPLUS3res_u; +}; +typedef struct READDIRPLUS3res READDIRPLUS3res; + +struct READDIR3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 count; +}; +typedef struct READDIR3args READDIR3args; + +struct entry3 { + fileid3 fileid; + filename3 name; + cookie3 cookie; + struct entry3 *nextentry; +}; +typedef struct entry3 entry3; + +struct dirlist3 { + entry3 *entries; + bool_t eof; +}; +typedef struct dirlist3 dirlist3; + +struct READDIR3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlist3 reply; +}; +typedef struct READDIR3resok READDIR3resok; + +struct READDIR3resfail { + post_op_attr dir_attributes; +}; +typedef struct READDIR3resfail READDIR3resfail; + +struct READDIR3res { + nfsstat3 status; + union { + READDIR3resok resok; + READDIR3resfail resfail; + } READDIR3res_u; +}; +typedef struct READDIR3res READDIR3res; + +struct LINK3args { + nfs_fh3 file; + diropargs3 link; +}; +typedef struct LINK3args LINK3args; + +struct LINK3resok { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; +typedef struct LINK3resok LINK3resok; + +struct LINK3resfail { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; +typedef struct LINK3resfail LINK3resfail; + +struct LINK3res { + nfsstat3 status; + union { + LINK3resok resok; + LINK3resfail resfail; + } LINK3res_u; +}; +typedef struct LINK3res LINK3res; + +struct sattrguard3 { + bool_t check; + union { + nfstime3 obj_ctime; + } sattrguard3_u; +}; +typedef struct sattrguard3 sattrguard3; + +struct SETATTR3args { + nfs_fh3 object; + sattr3 new_attributes; + sattrguard3 guard; +}; +typedef struct SETATTR3args SETATTR3args; + +struct SETATTR3resok { + wcc_data obj_wcc; +}; +typedef struct SETATTR3resok SETATTR3resok; + +struct SETATTR3resfail { + wcc_data obj_wcc; +}; +typedef struct SETATTR3resfail SETATTR3resfail; + +struct SETATTR3res { + nfsstat3 status; + union { + SETATTR3resok resok; + SETATTR3resfail resfail; + } SETATTR3res_u; +}; +typedef struct SETATTR3res SETATTR3res; + +enum nfsacl_type { + NFSACL_TYPE_USER_OBJ = 0x0001, + NFSACL_TYPE_USER = 0x0002, + NFSACL_TYPE_GROUP_OBJ = 0x0004, + NFSACL_TYPE_GROUP = 0x0008, + NFSACL_TYPE_CLASS_OBJ = 0x0010, + NFSACL_TYPE_CLASS = 0x0020, + NFSACL_TYPE_DEFAULT = 0x1000, + NFSACL_TYPE_DEFAULT_USER_OBJ = 0x1001, + NFSACL_TYPE_DEFAULT_USER = 0x1002, + NFSACL_TYPE_DEFAULT_GROUP_OBJ = 0x1004, + NFSACL_TYPE_DEFAULT_GROUP = 0x1008, + NFSACL_TYPE_DEFAULT_CLASS_OBJ = 0x1010, + NFSACL_TYPE_DEFAULT_OTHER_OBJ = 0x1020, +}; +typedef enum nfsacl_type nfsacl_type; +#define NFSACL_PERM_READ 0x04 +#define NFSACL_PERM_WRITE 0x02 +#define NFSACL_PERM_EXEC 0x01 + +struct nfsacl_ace { + enum nfsacl_type type; + u_int id; + u_int perm; +}; +typedef struct nfsacl_ace nfsacl_ace; +#define NFSACL_MASK_ACL_ENTRY 0x0001 +#define NFSACL_MASK_ACL_COUNT 0x0002 +#define NFSACL_MASK_ACL_DEFAULT_ENTRY 0x0004 +#define NFSACL_MASK_ACL_DEFAULT_COUNT 0x0008 + +struct GETACL3args { + nfs_fh3 dir; + u_int mask; +}; +typedef struct GETACL3args GETACL3args; + +struct GETACL3resok { + post_op_attr attr; + u_int mask; + u_int ace_count; + struct { + u_int ace_len; + struct nfsacl_ace *ace_val; + } ace; + u_int default_ace_count; + struct { + u_int default_ace_len; + struct nfsacl_ace *default_ace_val; + } default_ace; +}; +typedef struct GETACL3resok GETACL3resok; + +struct GETACL3res { + nfsstat3 status; + union { + GETACL3resok resok; + } GETACL3res_u; +}; +typedef struct GETACL3res GETACL3res; + +struct SETACL3args { + nfs_fh3 dir; + u_int mask; + u_int ace_count; + struct { + u_int ace_len; + struct nfsacl_ace *ace_val; + } ace; + u_int default_ace_count; + struct { + u_int default_ace_len; + struct nfsacl_ace *default_ace_val; + } default_ace; +}; +typedef struct SETACL3args SETACL3args; + +struct SETACL3resok { + post_op_attr attr; +}; +typedef struct SETACL3resok SETACL3resok; + +struct SETACL3res { + nfsstat3 status; + union { + SETACL3resok resok; + } SETACL3res_u; +}; +typedef struct SETACL3res SETACL3res; + +#define NFS_PROGRAM 100003 +#define NFS_V3 3 + +#if defined(__STDC__) || defined(__cplusplus) +#define NFS3_NULL 0 +extern void * nfs3_null_3(void *, CLIENT *); +extern void * nfs3_null_3_svc(void *, struct svc_req *); +#define NFS3_GETATTR 1 +extern GETATTR3res * nfs3_getattr_3(GETATTR3args *, CLIENT *); +extern GETATTR3res * nfs3_getattr_3_svc(GETATTR3args *, struct svc_req *); +#define NFS3_SETATTR 2 +extern SETATTR3res * nfs3_setattr_3(SETATTR3args *, CLIENT *); +extern SETATTR3res * nfs3_setattr_3_svc(SETATTR3args *, struct svc_req *); +#define NFS3_LOOKUP 3 +extern LOOKUP3res * nfs3_lookup_3(LOOKUP3args *, CLIENT *); +extern LOOKUP3res * nfs3_lookup_3_svc(LOOKUP3args *, struct svc_req *); +#define NFS3_ACCESS 4 +extern ACCESS3res * nfs3_access_3(ACCESS3args *, CLIENT *); +extern ACCESS3res * nfs3_access_3_svc(ACCESS3args *, struct svc_req *); +#define NFS3_READLINK 5 +extern READLINK3res * nfs3_readlink_3(READLINK3args *, CLIENT *); +extern READLINK3res * nfs3_readlink_3_svc(READLINK3args *, struct svc_req *); +#define NFS3_READ 6 +extern READ3res * nfs3_read_3(READ3args *, CLIENT *); +extern READ3res * nfs3_read_3_svc(READ3args *, struct svc_req *); +#define NFS3_WRITE 7 +extern WRITE3res * nfs3_write_3(WRITE3args *, CLIENT *); +extern WRITE3res * nfs3_write_3_svc(WRITE3args *, struct svc_req *); +#define NFS3_CREATE 8 +extern CREATE3res * nfs3_create_3(CREATE3args *, CLIENT *); +extern CREATE3res * nfs3_create_3_svc(CREATE3args *, struct svc_req *); +#define NFS3_MKDIR 9 +extern MKDIR3res * nfs3_mkdir_3(MKDIR3args *, CLIENT *); +extern MKDIR3res * nfs3_mkdir_3_svc(MKDIR3args *, struct svc_req *); +#define NFS3_SYMLINK 10 +extern SYMLINK3res * nfs3_symlink_3(SYMLINK3args *, CLIENT *); +extern SYMLINK3res * nfs3_symlink_3_svc(SYMLINK3args *, struct svc_req *); +#define NFS3_MKNOD 11 +extern MKNOD3res * nfs3_mknod_3(MKNOD3args *, CLIENT *); +extern MKNOD3res * nfs3_mknod_3_svc(MKNOD3args *, struct svc_req *); +#define NFS3_REMOVE 12 +extern REMOVE3res * nfs3_remove_3(REMOVE3args *, CLIENT *); +extern REMOVE3res * nfs3_remove_3_svc(REMOVE3args *, struct svc_req *); +#define NFS3_RMDIR 13 +extern RMDIR3res * nfs3_rmdir_3(RMDIR3args *, CLIENT *); +extern RMDIR3res * nfs3_rmdir_3_svc(RMDIR3args *, struct svc_req *); +#define NFS3_RENAME 14 +extern RENAME3res * nfs3_rename_3(RENAME3args *, CLIENT *); +extern RENAME3res * nfs3_rename_3_svc(RENAME3args *, struct svc_req *); +#define NFS3_LINK 15 +extern LINK3res * nfs3_link_3(LINK3args *, CLIENT *); +extern LINK3res * nfs3_link_3_svc(LINK3args *, struct svc_req *); +#define NFS3_READDIR 16 +extern READDIR3res * nfs3_readdir_3(READDIR3args *, CLIENT *); +extern READDIR3res * nfs3_readdir_3_svc(READDIR3args *, struct svc_req *); +#define NFS3_READDIRPLUS 17 +extern READDIRPLUS3res * nfs3_readdirplus_3(READDIRPLUS3args *, CLIENT *); +extern READDIRPLUS3res * nfs3_readdirplus_3_svc(READDIRPLUS3args *, struct svc_req *); +#define NFS3_FSSTAT 18 +extern FSSTAT3res * nfs3_fsstat_3(FSSTAT3args *, CLIENT *); +extern FSSTAT3res * nfs3_fsstat_3_svc(FSSTAT3args *, struct svc_req *); +#define NFS3_FSINFO 19 +extern FSINFO3res * nfs3_fsinfo_3(FSINFO3args *, CLIENT *); +extern FSINFO3res * nfs3_fsinfo_3_svc(FSINFO3args *, struct svc_req *); +#define NFS3_PATHCONF 20 +extern PATHCONF3res * nfs3_pathconf_3(PATHCONF3args *, CLIENT *); +extern PATHCONF3res * nfs3_pathconf_3_svc(PATHCONF3args *, struct svc_req *); +#define NFS3_COMMIT 21 +extern COMMIT3res * nfs3_commit_3(COMMIT3args *, CLIENT *); +extern COMMIT3res * nfs3_commit_3_svc(COMMIT3args *, struct svc_req *); +extern int nfs_program_3_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define NFS3_NULL 0 +extern void * nfs3_null_3(); +extern void * nfs3_null_3_svc(); +#define NFS3_GETATTR 1 +extern GETATTR3res * nfs3_getattr_3(); +extern GETATTR3res * nfs3_getattr_3_svc(); +#define NFS3_SETATTR 2 +extern SETATTR3res * nfs3_setattr_3(); +extern SETATTR3res * nfs3_setattr_3_svc(); +#define NFS3_LOOKUP 3 +extern LOOKUP3res * nfs3_lookup_3(); +extern LOOKUP3res * nfs3_lookup_3_svc(); +#define NFS3_ACCESS 4 +extern ACCESS3res * nfs3_access_3(); +extern ACCESS3res * nfs3_access_3_svc(); +#define NFS3_READLINK 5 +extern READLINK3res * nfs3_readlink_3(); +extern READLINK3res * nfs3_readlink_3_svc(); +#define NFS3_READ 6 +extern READ3res * nfs3_read_3(); +extern READ3res * nfs3_read_3_svc(); +#define NFS3_WRITE 7 +extern WRITE3res * nfs3_write_3(); +extern WRITE3res * nfs3_write_3_svc(); +#define NFS3_CREATE 8 +extern CREATE3res * nfs3_create_3(); +extern CREATE3res * nfs3_create_3_svc(); +#define NFS3_MKDIR 9 +extern MKDIR3res * nfs3_mkdir_3(); +extern MKDIR3res * nfs3_mkdir_3_svc(); +#define NFS3_SYMLINK 10 +extern SYMLINK3res * nfs3_symlink_3(); +extern SYMLINK3res * nfs3_symlink_3_svc(); +#define NFS3_MKNOD 11 +extern MKNOD3res * nfs3_mknod_3(); +extern MKNOD3res * nfs3_mknod_3_svc(); +#define NFS3_REMOVE 12 +extern REMOVE3res * nfs3_remove_3(); +extern REMOVE3res * nfs3_remove_3_svc(); +#define NFS3_RMDIR 13 +extern RMDIR3res * nfs3_rmdir_3(); +extern RMDIR3res * nfs3_rmdir_3_svc(); +#define NFS3_RENAME 14 +extern RENAME3res * nfs3_rename_3(); +extern RENAME3res * nfs3_rename_3_svc(); +#define NFS3_LINK 15 +extern LINK3res * nfs3_link_3(); +extern LINK3res * nfs3_link_3_svc(); +#define NFS3_READDIR 16 +extern READDIR3res * nfs3_readdir_3(); +extern READDIR3res * nfs3_readdir_3_svc(); +#define NFS3_READDIRPLUS 17 +extern READDIRPLUS3res * nfs3_readdirplus_3(); +extern READDIRPLUS3res * nfs3_readdirplus_3_svc(); +#define NFS3_FSSTAT 18 +extern FSSTAT3res * nfs3_fsstat_3(); +extern FSSTAT3res * nfs3_fsstat_3_svc(); +#define NFS3_FSINFO 19 +extern FSINFO3res * nfs3_fsinfo_3(); +extern FSINFO3res * nfs3_fsinfo_3_svc(); +#define NFS3_PATHCONF 20 +extern PATHCONF3res * nfs3_pathconf_3(); +extern PATHCONF3res * nfs3_pathconf_3_svc(); +#define NFS3_COMMIT 21 +extern COMMIT3res * nfs3_commit_3(); +extern COMMIT3res * nfs3_commit_3_svc(); +extern int nfs_program_3_freeresult (); +#endif /* K&R C */ + +#define NFSACL_PROGRAM 100227 +#define NFSACL_V3 3 + +#if defined(__STDC__) || defined(__cplusplus) +#define NFSACL3_NULL 0 +extern void * nfsacl3_null_3(void *, CLIENT *); +extern void * nfsacl3_null_3_svc(void *, struct svc_req *); +#define NFSACL3_GETACL 1 +extern GETACL3res * nfsacl3_getacl_3(GETACL3args *, CLIENT *); +extern GETACL3res * nfsacl3_getacl_3_svc(GETACL3args *, struct svc_req *); +#define NFSACL3_SETACL 2 +extern SETACL3res * nfsacl3_setacl_3(SETACL3args *, CLIENT *); +extern SETACL3res * nfsacl3_setacl_3_svc(SETACL3args *, struct svc_req *); +extern int nfsacl_program_3_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define NFSACL3_NULL 0 +extern void * nfsacl3_null_3(); +extern void * nfsacl3_null_3_svc(); +#define NFSACL3_GETACL 1 +extern GETACL3res * nfsacl3_getacl_3(); +extern GETACL3res * nfsacl3_getacl_3_svc(); +#define NFSACL3_SETACL 2 +extern SETACL3res * nfsacl3_setacl_3(); +extern SETACL3res * nfsacl3_setacl_3_svc(); +extern int nfsacl_program_3_freeresult (); +#endif /* K&R C */ + +/* the zdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t zdr_cookieverf3 (ZDR *, cookieverf3); +extern bool_t zdr_uint64 (ZDR *, uint64*); +extern bool_t zdr_cookie3 (ZDR *, cookie3*); +extern bool_t zdr_nfs_fh3 (ZDR *, nfs_fh3*); +extern bool_t zdr_filename3 (ZDR *, filename3*); +extern bool_t zdr_diropargs3 (ZDR *, diropargs3*); +extern bool_t zdr_ftype3 (ZDR *, ftype3*); +extern bool_t zdr_mode3 (ZDR *, mode3*); +extern bool_t zdr_uid3 (ZDR *, uid3*); +extern bool_t zdr_gid3 (ZDR *, gid3*); +extern bool_t zdr_size3 (ZDR *, size3*); +extern bool_t zdr_fileid3 (ZDR *, fileid3*); +extern bool_t zdr_specdata3 (ZDR *, specdata3*); +extern bool_t zdr_nfstime3 (ZDR *, nfstime3*); +extern bool_t zdr_fattr3 (ZDR *, fattr3*); +extern bool_t zdr_post_op_attr (ZDR *, post_op_attr*); +extern bool_t zdr_nfsstat3 (ZDR *, nfsstat3*); +extern bool_t zdr_stable_how (ZDR *, stable_how*); +extern bool_t zdr_offset3 (ZDR *, offset3*); +extern bool_t zdr_count3 (ZDR *, count3*); +extern bool_t zdr_wcc_attr (ZDR *, wcc_attr*); +extern bool_t zdr_pre_op_attr (ZDR *, pre_op_attr*); +extern bool_t zdr_wcc_data (ZDR *, wcc_data*); +extern bool_t zdr_WRITE3args (ZDR *, WRITE3args*); +extern bool_t zdr_writeverf3 (ZDR *, writeverf3); +extern bool_t zdr_WRITE3resok (ZDR *, WRITE3resok*); +extern bool_t zdr_WRITE3resfail (ZDR *, WRITE3resfail*); +extern bool_t zdr_WRITE3res (ZDR *, WRITE3res*); +extern bool_t zdr_LOOKUP3args (ZDR *, LOOKUP3args*); +extern bool_t zdr_LOOKUP3resok (ZDR *, LOOKUP3resok*); +extern bool_t zdr_LOOKUP3resfail (ZDR *, LOOKUP3resfail*); +extern bool_t zdr_LOOKUP3res (ZDR *, LOOKUP3res*); +extern bool_t zdr_COMMIT3args (ZDR *, COMMIT3args*); +extern bool_t zdr_COMMIT3resok (ZDR *, COMMIT3resok*); +extern bool_t zdr_COMMIT3resfail (ZDR *, COMMIT3resfail*); +extern bool_t zdr_COMMIT3res (ZDR *, COMMIT3res*); +extern bool_t zdr_ACCESS3args (ZDR *, ACCESS3args*); +extern bool_t zdr_ACCESS3resok (ZDR *, ACCESS3resok*); +extern bool_t zdr_ACCESS3resfail (ZDR *, ACCESS3resfail*); +extern bool_t zdr_ACCESS3res (ZDR *, ACCESS3res*); +extern bool_t zdr_GETATTR3args (ZDR *, GETATTR3args*); +extern bool_t zdr_GETATTR3resok (ZDR *, GETATTR3resok*); +extern bool_t zdr_GETATTR3res (ZDR *, GETATTR3res*); +extern bool_t zdr_time_how (ZDR *, time_how*); +extern bool_t zdr_set_mode3 (ZDR *, set_mode3*); +extern bool_t zdr_set_uid3 (ZDR *, set_uid3*); +extern bool_t zdr_set_gid3 (ZDR *, set_gid3*); +extern bool_t zdr_set_size3 (ZDR *, set_size3*); +extern bool_t zdr_set_atime (ZDR *, set_atime*); +extern bool_t zdr_set_mtime (ZDR *, set_mtime*); +extern bool_t zdr_sattr3 (ZDR *, sattr3*); +extern bool_t zdr_createmode3 (ZDR *, createmode3*); +extern bool_t zdr_createverf3 (ZDR *, createverf3); +extern bool_t zdr_createhow3 (ZDR *, createhow3*); +extern bool_t zdr_CREATE3args (ZDR *, CREATE3args*); +extern bool_t zdr_post_op_fh3 (ZDR *, post_op_fh3*); +extern bool_t zdr_CREATE3resok (ZDR *, CREATE3resok*); +extern bool_t zdr_CREATE3resfail (ZDR *, CREATE3resfail*); +extern bool_t zdr_CREATE3res (ZDR *, CREATE3res*); +extern bool_t zdr_REMOVE3args (ZDR *, REMOVE3args*); +extern bool_t zdr_REMOVE3resok (ZDR *, REMOVE3resok*); +extern bool_t zdr_REMOVE3resfail (ZDR *, REMOVE3resfail*); +extern bool_t zdr_REMOVE3res (ZDR *, REMOVE3res*); +extern bool_t zdr_READ3args (ZDR *, READ3args*); +extern bool_t zdr_READ3resok (ZDR *, READ3resok*); +extern bool_t zdr_READ3resfail (ZDR *, READ3resfail*); +extern bool_t zdr_READ3res (ZDR *, READ3res*); +extern bool_t zdr_FSINFO3args (ZDR *, FSINFO3args*); +extern bool_t zdr_FSINFO3resok (ZDR *, FSINFO3resok*); +extern bool_t zdr_FSINFO3resfail (ZDR *, FSINFO3resfail*); +extern bool_t zdr_FSINFO3res (ZDR *, FSINFO3res*); +extern bool_t zdr_FSSTAT3args (ZDR *, FSSTAT3args*); +extern bool_t zdr_FSSTAT3resok (ZDR *, FSSTAT3resok*); +extern bool_t zdr_FSSTAT3resfail (ZDR *, FSSTAT3resfail*); +extern bool_t zdr_FSSTAT3res (ZDR *, FSSTAT3res*); +extern bool_t zdr_PATHCONF3args (ZDR *, PATHCONF3args*); +extern bool_t zdr_PATHCONF3resok (ZDR *, PATHCONF3resok*); +extern bool_t zdr_PATHCONF3resfail (ZDR *, PATHCONF3resfail*); +extern bool_t zdr_PATHCONF3res (ZDR *, PATHCONF3res*); +extern bool_t zdr_nfspath3 (ZDR *, nfspath3*); +extern bool_t zdr_symlinkdata3 (ZDR *, symlinkdata3*); +extern bool_t zdr_SYMLINK3args (ZDR *, SYMLINK3args*); +extern bool_t zdr_SYMLINK3resok (ZDR *, SYMLINK3resok*); +extern bool_t zdr_SYMLINK3resfail (ZDR *, SYMLINK3resfail*); +extern bool_t zdr_SYMLINK3res (ZDR *, SYMLINK3res*); +extern bool_t zdr_READLINK3args (ZDR *, READLINK3args*); +extern bool_t zdr_READLINK3resok (ZDR *, READLINK3resok*); +extern bool_t zdr_READLINK3resfail (ZDR *, READLINK3resfail*); +extern bool_t zdr_READLINK3res (ZDR *, READLINK3res*); +extern bool_t zdr_devicedata3 (ZDR *, devicedata3*); +extern bool_t zdr_mknoddata3 (ZDR *, mknoddata3*); +extern bool_t zdr_MKNOD3args (ZDR *, MKNOD3args*); +extern bool_t zdr_MKNOD3resok (ZDR *, MKNOD3resok*); +extern bool_t zdr_MKNOD3resfail (ZDR *, MKNOD3resfail*); +extern bool_t zdr_MKNOD3res (ZDR *, MKNOD3res*); +extern bool_t zdr_MKDIR3args (ZDR *, MKDIR3args*); +extern bool_t zdr_MKDIR3resok (ZDR *, MKDIR3resok*); +extern bool_t zdr_MKDIR3resfail (ZDR *, MKDIR3resfail*); +extern bool_t zdr_MKDIR3res (ZDR *, MKDIR3res*); +extern bool_t zdr_RMDIR3args (ZDR *, RMDIR3args*); +extern bool_t zdr_RMDIR3resok (ZDR *, RMDIR3resok*); +extern bool_t zdr_RMDIR3resfail (ZDR *, RMDIR3resfail*); +extern bool_t zdr_RMDIR3res (ZDR *, RMDIR3res*); +extern bool_t zdr_RENAME3args (ZDR *, RENAME3args*); +extern bool_t zdr_RENAME3resok (ZDR *, RENAME3resok*); +extern bool_t zdr_RENAME3resfail (ZDR *, RENAME3resfail*); +extern bool_t zdr_RENAME3res (ZDR *, RENAME3res*); +extern bool_t zdr_READDIRPLUS3args (ZDR *, READDIRPLUS3args*); +extern bool_t zdr_entryplus3 (ZDR *, entryplus3*); +extern bool_t zdr_dirlistplus3 (ZDR *, dirlistplus3*); +extern bool_t zdr_READDIRPLUS3resok (ZDR *, READDIRPLUS3resok*); +extern bool_t zdr_READDIRPLUS3resfail (ZDR *, READDIRPLUS3resfail*); +extern bool_t zdr_READDIRPLUS3res (ZDR *, READDIRPLUS3res*); +extern bool_t zdr_READDIR3args (ZDR *, READDIR3args*); +extern bool_t zdr_entry3 (ZDR *, entry3*); +extern bool_t zdr_dirlist3 (ZDR *, dirlist3*); +extern bool_t zdr_READDIR3resok (ZDR *, READDIR3resok*); +extern bool_t zdr_READDIR3resfail (ZDR *, READDIR3resfail*); +extern bool_t zdr_READDIR3res (ZDR *, READDIR3res*); +extern bool_t zdr_LINK3args (ZDR *, LINK3args*); +extern bool_t zdr_LINK3resok (ZDR *, LINK3resok*); +extern bool_t zdr_LINK3resfail (ZDR *, LINK3resfail*); +extern bool_t zdr_LINK3res (ZDR *, LINK3res*); +extern bool_t zdr_sattrguard3 (ZDR *, sattrguard3*); +extern bool_t zdr_SETATTR3args (ZDR *, SETATTR3args*); +extern bool_t zdr_SETATTR3resok (ZDR *, SETATTR3resok*); +extern bool_t zdr_SETATTR3resfail (ZDR *, SETATTR3resfail*); +extern bool_t zdr_SETATTR3res (ZDR *, SETATTR3res*); +extern bool_t zdr_nfsacl_type (ZDR *, nfsacl_type*); +extern bool_t zdr_nfsacl_ace (ZDR *, nfsacl_ace*); +extern bool_t zdr_GETACL3args (ZDR *, GETACL3args*); +extern bool_t zdr_GETACL3resok (ZDR *, GETACL3resok*); +extern bool_t zdr_GETACL3res (ZDR *, GETACL3res*); +extern bool_t zdr_SETACL3args (ZDR *, SETACL3args*); +extern bool_t zdr_SETACL3resok (ZDR *, SETACL3resok*); +extern bool_t zdr_SETACL3res (ZDR *, SETACL3res*); + +#else /* K&R C */ +extern bool_t zdr_cookieverf3 (); +extern bool_t zdr_uint64 (); +extern bool_t zdr_cookie3 (); +extern bool_t zdr_nfs_fh3 (); +extern bool_t zdr_filename3 (); +extern bool_t zdr_diropargs3 (); +extern bool_t zdr_ftype3 (); +extern bool_t zdr_mode3 (); +extern bool_t zdr_uid3 (); +extern bool_t zdr_gid3 (); +extern bool_t zdr_size3 (); +extern bool_t zdr_fileid3 (); +extern bool_t zdr_specdata3 (); +extern bool_t zdr_nfstime3 (); +extern bool_t zdr_fattr3 (); +extern bool_t zdr_post_op_attr (); +extern bool_t zdr_nfsstat3 (); +extern bool_t zdr_stable_how (); +extern bool_t zdr_offset3 (); +extern bool_t zdr_count3 (); +extern bool_t zdr_wcc_attr (); +extern bool_t zdr_pre_op_attr (); +extern bool_t zdr_wcc_data (); +extern bool_t zdr_WRITE3args (); +extern bool_t zdr_writeverf3 (); +extern bool_t zdr_WRITE3resok (); +extern bool_t zdr_WRITE3resfail (); +extern bool_t zdr_WRITE3res (); +extern bool_t zdr_LOOKUP3args (); +extern bool_t zdr_LOOKUP3resok (); +extern bool_t zdr_LOOKUP3resfail (); +extern bool_t zdr_LOOKUP3res (); +extern bool_t zdr_COMMIT3args (); +extern bool_t zdr_COMMIT3resok (); +extern bool_t zdr_COMMIT3resfail (); +extern bool_t zdr_COMMIT3res (); +extern bool_t zdr_ACCESS3args (); +extern bool_t zdr_ACCESS3resok (); +extern bool_t zdr_ACCESS3resfail (); +extern bool_t zdr_ACCESS3res (); +extern bool_t zdr_GETATTR3args (); +extern bool_t zdr_GETATTR3resok (); +extern bool_t zdr_GETATTR3res (); +extern bool_t zdr_time_how (); +extern bool_t zdr_set_mode3 (); +extern bool_t zdr_set_uid3 (); +extern bool_t zdr_set_gid3 (); +extern bool_t zdr_set_size3 (); +extern bool_t zdr_set_atime (); +extern bool_t zdr_set_mtime (); +extern bool_t zdr_sattr3 (); +extern bool_t zdr_createmode3 (); +extern bool_t zdr_createverf3 (); +extern bool_t zdr_createhow3 (); +extern bool_t zdr_CREATE3args (); +extern bool_t zdr_post_op_fh3 (); +extern bool_t zdr_CREATE3resok (); +extern bool_t zdr_CREATE3resfail (); +extern bool_t zdr_CREATE3res (); +extern bool_t zdr_REMOVE3args (); +extern bool_t zdr_REMOVE3resok (); +extern bool_t zdr_REMOVE3resfail (); +extern bool_t zdr_REMOVE3res (); +extern bool_t zdr_READ3args (); +extern bool_t zdr_READ3resok (); +extern bool_t zdr_READ3resfail (); +extern bool_t zdr_READ3res (); +extern bool_t zdr_FSINFO3args (); +extern bool_t zdr_FSINFO3resok (); +extern bool_t zdr_FSINFO3resfail (); +extern bool_t zdr_FSINFO3res (); +extern bool_t zdr_FSSTAT3args (); +extern bool_t zdr_FSSTAT3resok (); +extern bool_t zdr_FSSTAT3resfail (); +extern bool_t zdr_FSSTAT3res (); +extern bool_t zdr_PATHCONF3args (); +extern bool_t zdr_PATHCONF3resok (); +extern bool_t zdr_PATHCONF3resfail (); +extern bool_t zdr_PATHCONF3res (); +extern bool_t zdr_nfspath3 (); +extern bool_t zdr_symlinkdata3 (); +extern bool_t zdr_SYMLINK3args (); +extern bool_t zdr_SYMLINK3resok (); +extern bool_t zdr_SYMLINK3resfail (); +extern bool_t zdr_SYMLINK3res (); +extern bool_t zdr_READLINK3args (); +extern bool_t zdr_READLINK3resok (); +extern bool_t zdr_READLINK3resfail (); +extern bool_t zdr_READLINK3res (); +extern bool_t zdr_devicedata3 (); +extern bool_t zdr_mknoddata3 (); +extern bool_t zdr_MKNOD3args (); +extern bool_t zdr_MKNOD3resok (); +extern bool_t zdr_MKNOD3resfail (); +extern bool_t zdr_MKNOD3res (); +extern bool_t zdr_MKDIR3args (); +extern bool_t zdr_MKDIR3resok (); +extern bool_t zdr_MKDIR3resfail (); +extern bool_t zdr_MKDIR3res (); +extern bool_t zdr_RMDIR3args (); +extern bool_t zdr_RMDIR3resok (); +extern bool_t zdr_RMDIR3resfail (); +extern bool_t zdr_RMDIR3res (); +extern bool_t zdr_RENAME3args (); +extern bool_t zdr_RENAME3resok (); +extern bool_t zdr_RENAME3resfail (); +extern bool_t zdr_RENAME3res (); +extern bool_t zdr_READDIRPLUS3args (); +extern bool_t zdr_entryplus3 (); +extern bool_t zdr_dirlistplus3 (); +extern bool_t zdr_READDIRPLUS3resok (); +extern bool_t zdr_READDIRPLUS3resfail (); +extern bool_t zdr_READDIRPLUS3res (); +extern bool_t zdr_READDIR3args (); +extern bool_t zdr_entry3 (); +extern bool_t zdr_dirlist3 (); +extern bool_t zdr_READDIR3resok (); +extern bool_t zdr_READDIR3resfail (); +extern bool_t zdr_READDIR3res (); +extern bool_t zdr_LINK3args (); +extern bool_t zdr_LINK3resok (); +extern bool_t zdr_LINK3resfail (); +extern bool_t zdr_LINK3res (); +extern bool_t zdr_sattrguard3 (); +extern bool_t zdr_SETATTR3args (); +extern bool_t zdr_SETATTR3resok (); +extern bool_t zdr_SETATTR3resfail (); +extern bool_t zdr_SETATTR3res (); +extern bool_t zdr_nfsacl_type (); +extern bool_t zdr_nfsacl_ace (); +extern bool_t zdr_GETACL3args (); +extern bool_t zdr_GETACL3resok (); +extern bool_t zdr_GETACL3res (); +extern bool_t zdr_SETACL3args (); +extern bool_t zdr_SETACL3resok (); +extern bool_t zdr_SETACL3res (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NFS_H_RPCGEN */ diff --git a/nfs/nfs.c b/nfs/nfs.c index b6f2728..361502f 100644 --- a/nfs/nfs.c +++ b/nfs/nfs.c @@ -24,8 +24,7 @@ #include #include #include -#include -#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" @@ -108,7 +107,7 @@ int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_NULL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_NULL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/null call"); return -1; @@ -128,7 +127,7 @@ int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh struct rpc_pdu *pdu; GETATTR3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_GETATTR, cb, private_data, (xdrproc_t)xdr_GETATTR3res, sizeof(GETATTR3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_GETATTR, cb, private_data, (zdrproc_t)zdr_GETATTR3res, sizeof(GETATTR3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/null call"); return -1; @@ -137,8 +136,8 @@ int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh args.object.data.data_len = fh->data.data_len; args.object.data.data_val = fh->data.data_val; - if (xdr_GETATTR3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode GETATTR3args"); + if (zdr_GETATTR3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode GETATTR3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -157,7 +156,7 @@ int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; LOOKUP3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_LOOKUP, cb, private_data, (xdrproc_t)xdr_LOOKUP3res, sizeof(LOOKUP3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_LOOKUP, cb, private_data, (zdrproc_t)zdr_LOOKUP3res, sizeof(LOOKUP3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/lookup call"); return -1; @@ -167,8 +166,8 @@ int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.what.dir.data.data_val = fh->data.data_val; args.what.name = name; - if (xdr_LOOKUP3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode LOOKUP3args"); + if (zdr_LOOKUP3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode LOOKUP3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -188,7 +187,7 @@ int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; ACCESS3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_ACCESS, cb, private_data, (xdrproc_t)xdr_ACCESS3res, sizeof(ACCESS3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_ACCESS, cb, private_data, (zdrproc_t)zdr_ACCESS3res, sizeof(ACCESS3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/access call"); return -1; @@ -198,8 +197,8 @@ int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.object.data.data_val = fh->data.data_val; args.access = access; - if (xdr_ACCESS3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode ACCESS3args"); + if (zdr_ACCESS3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode ACCESS3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -220,7 +219,7 @@ int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, u struct rpc_pdu *pdu; READ3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READ, cb, private_data, (xdrproc_t)xdr_READ3res, sizeof(READ3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READ, cb, private_data, (zdrproc_t)zdr_READ3res, sizeof(READ3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/read call"); return -1; @@ -231,8 +230,8 @@ int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, u args.offset = offset; args.count = count; - if (xdr_READ3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode READ3args"); + if (zdr_READ3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode READ3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -252,7 +251,7 @@ int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; WRITE3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_WRITE, cb, private_data, (xdrproc_t)xdr_WRITE3res, sizeof(WRITE3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_WRITE, cb, private_data, (zdrproc_t)zdr_WRITE3res, sizeof(WRITE3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/write call"); return -1; @@ -266,8 +265,8 @@ int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.data.data_len = count; args.data.data_val = buf; - if (xdr_WRITE3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode WRITE3args"); + if (zdr_WRITE3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode WRITE3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -288,7 +287,7 @@ int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; COMMIT3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_COMMIT, cb, private_data, (xdrproc_t)xdr_COMMIT3res, sizeof(COMMIT3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_COMMIT, cb, private_data, (zdrproc_t)zdr_COMMIT3res, sizeof(COMMIT3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/commit call"); return -1; @@ -299,8 +298,8 @@ int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.offset = 0; args.count = 0; - if (xdr_COMMIT3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode WRITE3args"); + if (zdr_COMMIT3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode WRITE3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -319,14 +318,14 @@ int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, SETATTR3args *args { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SETATTR, cb, private_data, (xdrproc_t)xdr_SETATTR3res, sizeof(SETATTR3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SETATTR, cb, private_data, (zdrproc_t)zdr_SETATTR3res, sizeof(SETATTR3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/setattr call"); return -1; } - if (xdr_SETATTR3args(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode SETATTR3args"); + if (zdr_SETATTR3args(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode SETATTR3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -346,14 +345,14 @@ int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, MKDIR3args *args, vo { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_MKDIR, cb, private_data, (xdrproc_t)xdr_MKDIR3res, sizeof(MKDIR3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_MKDIR, cb, private_data, (zdrproc_t)zdr_MKDIR3res, sizeof(MKDIR3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/setattr call"); return -1; } - if (xdr_MKDIR3args(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode MKDIR3args"); + if (zdr_MKDIR3args(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode MKDIR3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -375,7 +374,7 @@ int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; RMDIR3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_RMDIR, cb, private_data, (xdrproc_t)xdr_RMDIR3res, sizeof(RMDIR3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_RMDIR, cb, private_data, (zdrproc_t)zdr_RMDIR3res, sizeof(RMDIR3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/rmdir call"); return -1; @@ -386,8 +385,8 @@ int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.object.dir.data.data_val = fh->data.data_val; args.object.name = dir; - if (xdr_RMDIR3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode RMDIR3args"); + if (zdr_RMDIR3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode RMDIR3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -407,14 +406,14 @@ int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, CREATE3args *args, { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_CREATE, cb, private_data, (xdrproc_t)xdr_CREATE3res, sizeof(CREATE3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_CREATE, cb, private_data, (zdrproc_t)zdr_CREATE3res, sizeof(CREATE3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/create call"); return -1; } - if (xdr_CREATE3args(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode CREATE3args"); + if (zdr_CREATE3args(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode CREATE3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -435,7 +434,7 @@ int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; MKNOD3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_MKNOD, cb, private_data, (xdrproc_t)xdr_MKNOD3res, sizeof(MKNOD3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_MKNOD, cb, private_data, (zdrproc_t)zdr_MKNOD3res, sizeof(MKNOD3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/mknod call"); return -1; @@ -475,8 +474,8 @@ int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, return -1; } - if (xdr_MKNOD3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode MKNOD3args"); + if (zdr_MKNOD3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode MKNOD3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -496,7 +495,7 @@ int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; REMOVE3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_REMOVE, cb, private_data, (xdrproc_t)xdr_REMOVE3res, sizeof(REMOVE3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_REMOVE, cb, private_data, (zdrproc_t)zdr_REMOVE3res, sizeof(REMOVE3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/remove call"); return -1; @@ -507,8 +506,8 @@ int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.object.dir.data.data_val = fh->data.data_val; args.object.name = file; - if (xdr_REMOVE3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode REMOVE3args"); + if (zdr_REMOVE3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode REMOVE3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -527,7 +526,7 @@ int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh struct rpc_pdu *pdu; READDIR3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIR, cb, private_data, (xdrproc_t)xdr_READDIR3res, sizeof(READDIR3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIR, cb, private_data, (zdrproc_t)zdr_READDIR3res, sizeof(READDIR3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/readdir call"); return -1; @@ -540,8 +539,8 @@ int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh memcpy(&args.cookieverf, cookieverf, sizeof(cookieverf3)); args.count = count; - if (xdr_READDIR3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode READDIR3args"); + if (zdr_READDIR3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode READDIR3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -560,7 +559,7 @@ int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 struct rpc_pdu *pdu; READDIRPLUS3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIRPLUS, cb, private_data, (xdrproc_t)xdr_READDIRPLUS3res, sizeof(READDIRPLUS3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIRPLUS, cb, private_data, (zdrproc_t)zdr_READDIRPLUS3res, sizeof(READDIRPLUS3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/readdirplus call"); return -1; @@ -574,8 +573,8 @@ int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 args.dircount = count; args.maxcount = count; - if (xdr_READDIRPLUS3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode READDIRPLUS3args"); + if (zdr_READDIRPLUS3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode READDIRPLUS3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -594,7 +593,7 @@ int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; FSSTAT3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSSTAT, cb, private_data, (xdrproc_t)xdr_FSSTAT3res, sizeof(FSSTAT3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSSTAT, cb, private_data, (zdrproc_t)zdr_FSSTAT3res, sizeof(FSSTAT3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/fsstat call"); return -1; @@ -603,8 +602,8 @@ int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.fsroot.data.data_len = fh->data.data_len; args.fsroot.data.data_val = fh->data.data_val; - if (xdr_FSSTAT3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode FSSTAT3args"); + if (zdr_FSSTAT3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode FSSTAT3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -623,7 +622,7 @@ int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, struct rpc_pdu *pdu; FSINFO3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSINFO, cb, private_data, (xdrproc_t)xdr_FSINFO3res, sizeof(FSINFO3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSINFO, cb, private_data, (zdrproc_t)zdr_FSINFO3res, sizeof(FSINFO3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/fsinfo call"); return -1; @@ -632,8 +631,8 @@ int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, args.fsroot.data.data_len = fh->data.data_len; args.fsroot.data.data_val = fh->data.data_val; - if (xdr_FSINFO3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode FSINFO3args"); + if (zdr_FSINFO3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode FSINFO3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -651,14 +650,14 @@ int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, READLINK3args *ar { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READLINK, cb, private_data, (xdrproc_t)xdr_READLINK3res, sizeof(READLINK3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READLINK, cb, private_data, (zdrproc_t)zdr_READLINK3res, sizeof(READLINK3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/readlink call"); return -1; } - if (xdr_READLINK3args(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode READLINK3args"); + if (zdr_READLINK3args(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode READLINK3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -677,14 +676,14 @@ int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, SYMLINK3args *args { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SYMLINK, cb, private_data, (xdrproc_t)xdr_SYMLINK3res, sizeof(SYMLINK3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SYMLINK, cb, private_data, (zdrproc_t)zdr_SYMLINK3res, sizeof(SYMLINK3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/symlink call"); return -1; } - if (xdr_SYMLINK3args(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode SYMLINK3args"); + if (zdr_SYMLINK3args(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode SYMLINK3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -706,7 +705,7 @@ int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *old struct rpc_pdu *pdu; RENAME3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_RENAME, cb, private_data, (xdrproc_t)xdr_RENAME3res, sizeof(RENAME3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_RENAME, cb, private_data, (zdrproc_t)zdr_RENAME3res, sizeof(RENAME3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/rename call"); return -1; @@ -720,8 +719,8 @@ int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *old args.to.dir.data.data_val = newdir->data.data_val; args.to.name = newname; - if (xdr_RENAME3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode RENAME3args"); + if (zdr_RENAME3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode RENAME3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -743,7 +742,7 @@ int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct rpc_pdu *pdu; LINK3args args; - pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_LINK, cb, private_data, (xdrproc_t)xdr_LINK3res, sizeof(LINK3res)); + pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_LINK, cb, private_data, (zdrproc_t)zdr_LINK3res, sizeof(LINK3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/link call"); return -1; @@ -756,8 +755,8 @@ int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, args.link.dir.data.data_val = newdir->data.data_val; args.link.name = newname; - if (xdr_LINK3args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode LINK3args"); + if (zdr_LINK3args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode LINK3args"); rpc_free_pdu(rpc, pdu); return -2; } diff --git a/nfs/nfs.x b/nfs/nfs.x index 31f378b..c259aa6 100644 --- a/nfs/nfs.x +++ b/nfs/nfs.x @@ -39,44 +39,40 @@ enum ftype3 { NF3FIFO = 7 }; -typedef unsigned long uint32; +typedef unsigned int mode3; -typedef long int32; +typedef unsigned int uid3; -typedef uint32 mode3; - -typedef uint32 uid3; - -typedef uint32 gid3; +typedef unsigned int gid3; typedef uint64 size3; typedef uint64 fileid3; struct specdata3 { - uint32 specdata1; - uint32 specdata2; + unsigned int specdata1; + unsigned int specdata2; }; struct nfstime3 { - uint32 seconds; - uint32 nseconds; + unsigned int seconds; + unsigned int nseconds; }; struct fattr3 { - ftype3 type; - mode3 mode; - uint32 nlink; - uid3 uid; - gid3 gid; - size3 size; - size3 used; - specdata3 rdev; - uint64 fsid; - fileid3 fileid; - nfstime3 atime; - nfstime3 mtime; - nfstime3 ctime; + ftype3 type; + mode3 mode; + unsigned int nlink; + uid3 uid; + gid3 gid; + size3 size; + size3 used; + specdata3 rdev; + uint64 fsid; + fileid3 fileid; + nfstime3 atime; + nfstime3 mtime; + nfstime3 ctime; }; union post_op_attr switch (bool attributes_follow) { @@ -127,7 +123,7 @@ enum stable_how { typedef uint64 offset3; -typedef uint32 count3; +typedef unsigned int count3; struct wcc_attr { size3 size; @@ -228,13 +224,13 @@ const ACCESS3_DELETE = 0x0010; const ACCESS3_EXECUTE = 0x0020; struct ACCESS3args { - nfs_fh3 object; - uint32 access; + nfs_fh3 object; + unsigned int access; }; struct ACCESS3resok { - post_op_attr obj_attributes; - uint32 access; + post_op_attr obj_attributes; + unsigned int access; }; struct ACCESS3resfail { @@ -424,16 +420,16 @@ struct FSINFO3args { struct FSINFO3resok { post_op_attr obj_attributes; - uint32 rtmax; - uint32 rtpref; - uint32 rtmult; - uint32 wtmax; - uint32 wtpref; - uint32 wtmult; - uint32 dtpref; + unsigned int rtmax; + unsigned int rtpref; + unsigned int rtmult; + unsigned int wtmax; + unsigned int wtpref; + unsigned int wtmult; + unsigned int dtpref; size3 maxfilesize; nfstime3 time_delta; - uint32 properties; + unsigned int properties; }; struct FSINFO3resfail { @@ -460,7 +456,7 @@ struct FSSTAT3resok { size3 tfiles; size3 ffiles; size3 afiles; - uint32 invarsec; + unsigned int invarsec; }; struct FSSTAT3resfail { @@ -480,8 +476,8 @@ struct PATHCONF3args { struct PATHCONF3resok { post_op_attr obj_attributes; - uint32 linkmax; - uint32 name_max; + unsigned int linkmax; + unsigned int name_max; bool no_trunc; bool chown_restricted; bool case_insensitive; @@ -878,8 +874,8 @@ const NFSACL_PERM_EXEC = 0x01; struct nfsacl_ace { enum nfsacl_type type; - uint32_t id; - uint32_t perm; + unsigned int id; + unsigned int perm; }; const NFSACL_MASK_ACL_ENTRY = 0x0001; @@ -888,17 +884,17 @@ const NFSACL_MASK_ACL_DEFAULT_ENTRY = 0x0004; const NFSACL_MASK_ACL_DEFAULT_COUNT = 0x0008; struct GETACL3args { - nfs_fh3 dir; - uint32 mask; + nfs_fh3 dir; + unsigned int mask; }; struct GETACL3resok { - post_op_attr attr; - uint32_t mask; - uint32_t ace_count; - struct nfsacl_ace ace<>; - uint32_t default_ace_count; - struct nfsacl_ace default_ace<>; + post_op_attr attr; + unsigned int mask; + unsigned int ace_count; + struct nfsacl_ace ace<>; + unsigned int default_ace_count; + struct nfsacl_ace default_ace<>; }; union GETACL3res switch (nfsstat3 status) { @@ -909,12 +905,12 @@ default: }; struct SETACL3args { - nfs_fh3 dir; - uint32_t mask; - uint32_t ace_count; - struct nfsacl_ace ace<>; - uint32_t default_ace_count; - struct nfsacl_ace default_ace<>; + nfs_fh3 dir; + unsigned int mask; + unsigned int ace_count; + struct nfsacl_ace ace<>; + unsigned int default_ace_count; + struct nfsacl_ace default_ace<>; }; struct SETACL3resok { diff --git a/nfs/nfsacl.c b/nfs/nfsacl.c index a3c3ede..e074dce 100644 --- a/nfs/nfsacl.c +++ b/nfs/nfsacl.c @@ -23,8 +23,7 @@ #include #include #include -#include -#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" @@ -35,7 +34,7 @@ int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_NULL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_NULL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfsacl/null call"); return -1; @@ -55,14 +54,14 @@ int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct GETACL3ar { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_GETACL, cb, private_data, (xdrproc_t)xdr_GETACL3res, sizeof(GETACL3res)); + pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_GETACL, cb, private_data, (zdrproc_t)zdr_GETACL3res, sizeof(GETACL3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfsacl/getacl call"); return -1; } - if (xdr_GETACL3args(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode GETACL3args"); + if (zdr_GETACL3args(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode GETACL3args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -80,14 +79,14 @@ int rpc_nfsacl_setacl_async(struct rpc_context *rpc, rpc_cb cb, struct SETACL3ar { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_SETACL, cb, private_data, (xdrproc_t)xdr_SETACL3res, sizeof(SETACL3res)); + pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_SETACL, cb, private_data, (zdrproc_t)zdr_SETACL3res, sizeof(SETACL3res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfsacl/setacl call"); return -1; } - if (xdr_SETACL3args(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode SETACL3args"); + if (zdr_SETACL3args(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode SETACL3args"); rpc_free_pdu(rpc, pdu); return -2; } diff --git a/nlm/Makefile.am b/nlm/Makefile.am index 7ec82da..6945c1b 100644 --- a/nlm/Makefile.am +++ b/nlm/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libnlm.la -nlm_SOURCES_GENERATED = libnfs-raw-nlm.c -nlm_HEADERS_GENERATED = libnfs-raw-nlm.h +nlm_SOURCES_GENERATED = +nlm_HEADERS_GENERATED = nlm_GENERATED = $(nlm_SOURCES_GENERATED) $(nlm_HEADERS_GENERATED) CLEANFILES = $(nlm_GENERATED) nlm-stamp @@ -9,12 +9,13 @@ CLEANFILES = $(nlm_GENERATED) nlm-stamp libnlm_la_CPPFLAGS = -I$(abs_top_srcdir)/include libnlm_la_SOURCES = \ $(nlm_SOURCES_GENERATED) \ - nlm.c + nlm.c libnfs-raw-nlm.c $(nlm_GENERATED) : nlm-stamp nlm-stamp : nlm.x rm -f $(nlm_GENERATED) - rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-nlm.h - rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*nlm.h\"/#include \"libnfs-raw-nlm.h\"/" > libnfs-raw-nlm.c touch nlm-stamp - + +compile_rpc: + rpcgen -h @RPCGENFLAGS@ nlm.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-nlm.h + rpcgen -c @RPCGENFLAGS@ nlm.x | sed -e "s/#include \".*nlm.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nlm.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-nlm.c diff --git a/nlm/libnfs-raw-nlm.c b/nlm/libnfs-raw-nlm.c new file mode 100644 index 0000000..08417d4 --- /dev/null +++ b/nlm/libnfs-raw-nlm.c @@ -0,0 +1,267 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "libnfs-zdr.h" +#include "libnfs-raw-nlm.h" + +bool_t +zdr_nlm_fh4 (ZDR *zdrs, nlm_fh4 *objp) +{ + register int32_t *buf; + + if (!zdr_bytes (zdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlm4_oh (ZDR *zdrs, nlm4_oh *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, objp, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlm_cookie (ZDR *zdrs, nlm_cookie *objp) +{ + register int32_t *buf; + + if (!zdr_bytes (zdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlmstat4 (ZDR *zdrs, nlmstat4 *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlm4_holder (ZDR *zdrs, nlm4_holder *objp) +{ + register int32_t *buf; + + if (!zdr_bool (zdrs, &objp->exclusive)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->svid)) + return FALSE; + if (!zdr_nlm4_oh (zdrs, &objp->oh)) + return FALSE; + if (!zdr_u_quad_t (zdrs, &objp->l_offset)) + return FALSE; + if (!zdr_u_quad_t (zdrs, &objp->l_len)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlm4_lock (ZDR *zdrs, nlm4_lock *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, &objp->caller_name, NLM_MAXNAME)) + return FALSE; + if (!zdr_nlm_fh4 (zdrs, &objp->fh)) + return FALSE; + if (!zdr_nlm4_oh (zdrs, &objp->oh)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->svid)) + return FALSE; + if (!zdr_u_quad_t (zdrs, &objp->l_offset)) + return FALSE; + if (!zdr_u_quad_t (zdrs, &objp->l_len)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlm4_share (ZDR *zdrs, nlm4_share *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, &objp->caller_name, NLM_MAXNAME)) + return FALSE; + if (!zdr_nlm_fh4 (zdrs, &objp->fh)) + return FALSE; + if (!zdr_nlm4_oh (zdrs, &objp->oh)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->mode)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->access)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlm4_testres_denied (ZDR *zdrs, nlm4_testres_denied *objp) +{ + register int32_t *buf; + + if (!zdr_nlm4_holder (zdrs, &objp->holder)) + return FALSE; + return TRUE; +} + +bool_t +zdr_nlm4_testreply (ZDR *zdrs, nlm4_testreply *objp) +{ + register int32_t *buf; + + if (!zdr_nlmstat4 (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case NLM4_DENIED: + if (!zdr_nlm4_testres_denied (zdrs, &objp->nlm4_testreply_u.lock)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +zdr_NLM4_TESTres (ZDR *zdrs, NLM4_TESTres *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_nlm4_testreply (zdrs, &objp->reply)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_TESTargs (ZDR *zdrs, NLM4_TESTargs *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_bool (zdrs, &objp->exclusive)) + return FALSE; + if (!zdr_nlm4_lock (zdrs, &objp->lock)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_CANCres (ZDR *zdrs, NLM4_CANCres *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_nlmstat4 (zdrs, &objp->status)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_CANCargs (ZDR *zdrs, NLM4_CANCargs *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_bool (zdrs, &objp->block)) + return FALSE; + if (!zdr_bool (zdrs, &objp->exclusive)) + return FALSE; + if (!zdr_nlm4_lock (zdrs, &objp->lock)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_UNLOCKres (ZDR *zdrs, NLM4_UNLOCKres *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_nlmstat4 (zdrs, &objp->status)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_UNLOCKargs (ZDR *zdrs, NLM4_UNLOCKargs *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_nlm4_lock (zdrs, &objp->lock)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_LOCKres (ZDR *zdrs, NLM4_LOCKres *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_nlmstat4 (zdrs, &objp->status)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_LOCKargs (ZDR *zdrs, NLM4_LOCKargs *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_bool (zdrs, &objp->block)) + return FALSE; + if (!zdr_bool (zdrs, &objp->exclusive)) + return FALSE; + if (!zdr_nlm4_lock (zdrs, &objp->lock)) + return FALSE; + if (!zdr_bool (zdrs, &objp->reclaim)) + return FALSE; + if (!zdr_int (zdrs, &objp->state)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_GRANTEDargs (ZDR *zdrs, NLM4_GRANTEDargs *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_bool (zdrs, &objp->exclusive)) + return FALSE; + if (!zdr_nlm4_lock (zdrs, &objp->lock)) + return FALSE; + return TRUE; +} + +bool_t +zdr_NLM4_GRANTEDres (ZDR *zdrs, NLM4_GRANTEDres *objp) +{ + register int32_t *buf; + + if (!zdr_nlm_cookie (zdrs, &objp->cookie)) + return FALSE; + if (!zdr_nlmstat4 (zdrs, &objp->status)) + return FALSE; + return TRUE; +} diff --git a/nlm/libnfs-raw-nlm.h b/nlm/libnfs-raw-nlm.h new file mode 100644 index 0000000..b50e934 --- /dev/null +++ b/nlm/libnfs-raw-nlm.h @@ -0,0 +1,315 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _NLM_H_RPCGEN +#define _NLM_H_RPCGEN + + + + +#ifdef __cplusplus +extern "C" { +#endif + + +struct nlm_fh4 { + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct nlm_fh4 nlm_fh4; + +typedef char *nlm4_oh; + +struct nlm_cookie { + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct nlm_cookie nlm_cookie; + +enum nlmstat4 { + NLM4_GRANTED = 0, + NLM4_DENIED = 1, + NLM4_DENIED_NOLOCKS = 2, + NLM4_BLOCKED = 3, + NLM4_DENIED_GRACE_PERIOD = 4, + NLM4_DEADLCK = 5, + NLM4_ROFS = 6, + NLM4_STALE_FH = 7, + NLM4_FBIG = 8, + NLM4_FAILED = 9, +}; +typedef enum nlmstat4 nlmstat4; + +struct nlm4_holder { + bool_t exclusive; + u_int svid; + nlm4_oh oh; + u_quad_t l_offset; + u_quad_t l_len; +}; +typedef struct nlm4_holder nlm4_holder; +#define NLM_MAXNAME 256 + +struct nlm4_lock { + char *caller_name; + struct nlm_fh4 fh; + nlm4_oh oh; + u_int svid; + u_quad_t l_offset; + u_quad_t l_len; +}; +typedef struct nlm4_lock nlm4_lock; + +struct nlm4_share { + char *caller_name; + struct nlm_fh4 fh; + nlm4_oh oh; + u_int mode; + u_int access; +}; +typedef struct nlm4_share nlm4_share; + +struct nlm4_testres_denied { + nlm4_holder holder; +}; +typedef struct nlm4_testres_denied nlm4_testres_denied; + +struct nlm4_testreply { + nlmstat4 status; + union { + nlm4_testres_denied lock; + } nlm4_testreply_u; +}; +typedef struct nlm4_testreply nlm4_testreply; + +struct NLM4_TESTres { + nlm_cookie cookie; + nlm4_testreply reply; +}; +typedef struct NLM4_TESTres NLM4_TESTres; + +struct NLM4_TESTargs { + nlm_cookie cookie; + bool_t exclusive; + nlm4_lock lock; +}; +typedef struct NLM4_TESTargs NLM4_TESTargs; + +struct NLM4_CANCres { + nlm_cookie cookie; + nlmstat4 status; +}; +typedef struct NLM4_CANCres NLM4_CANCres; + +struct NLM4_CANCargs { + nlm_cookie cookie; + bool_t block; + bool_t exclusive; + nlm4_lock lock; +}; +typedef struct NLM4_CANCargs NLM4_CANCargs; + +struct NLM4_UNLOCKres { + nlm_cookie cookie; + nlmstat4 status; +}; +typedef struct NLM4_UNLOCKres NLM4_UNLOCKres; + +struct NLM4_UNLOCKargs { + nlm_cookie cookie; + nlm4_lock lock; +}; +typedef struct NLM4_UNLOCKargs NLM4_UNLOCKargs; + +struct NLM4_LOCKres { + nlm_cookie cookie; + nlmstat4 status; +}; +typedef struct NLM4_LOCKres NLM4_LOCKres; + +struct NLM4_LOCKargs { + nlm_cookie cookie; + bool_t block; + bool_t exclusive; + nlm4_lock lock; + bool_t reclaim; + int state; +}; +typedef struct NLM4_LOCKargs NLM4_LOCKargs; + +struct NLM4_GRANTEDargs { + nlm_cookie cookie; + bool_t exclusive; + nlm4_lock lock; +}; +typedef struct NLM4_GRANTEDargs NLM4_GRANTEDargs; + +struct NLM4_GRANTEDres { + nlm_cookie cookie; + nlmstat4 status; +}; +typedef struct NLM4_GRANTEDres NLM4_GRANTEDres; + +#define NLM_PROGRAM 100021 +#define NLM_V4 4 + +#if defined(__STDC__) || defined(__cplusplus) +#define NLM4_NULL 0 +extern void * nlm4_null_4(void *, CLIENT *); +extern void * nlm4_null_4_svc(void *, struct svc_req *); +#define NLM4_TEST 1 +extern NLM4_TESTres * nlm4_test_4(NLM4_TESTargs *, CLIENT *); +extern NLM4_TESTres * nlm4_test_4_svc(NLM4_TESTargs *, struct svc_req *); +#define NLM4_LOCK 2 +extern NLM4_LOCKres * nlm4_lock_4(NLM4_LOCKargs *, CLIENT *); +extern NLM4_LOCKres * nlm4_lock_4_svc(NLM4_LOCKargs *, struct svc_req *); +#define NLM4_CANCEL 3 +extern NLM4_CANCres * nlm4_cancel_4(NLM4_CANCargs *, CLIENT *); +extern NLM4_CANCres * nlm4_cancel_4_svc(NLM4_CANCargs *, struct svc_req *); +#define NLM4_UNLOCK 4 +extern NLM4_UNLOCKres * nlm4_unlock_4(NLM4_UNLOCKargs *, CLIENT *); +extern NLM4_UNLOCKres * nlm4_unlock_4_svc(NLM4_UNLOCKargs *, struct svc_req *); +#define NLM4_GRANT 5 +extern NLM4_GRANTEDres * nlm4_grant_4(NLM4_GRANTEDargs *, CLIENT *); +extern NLM4_GRANTEDres * nlm4_grant_4_svc(NLM4_GRANTEDargs *, struct svc_req *); +#define NLM4_TEST_MSG 6 +extern void * nlm4_test_msg_4(NLM4_TESTargs *, CLIENT *); +extern void * nlm4_test_msg_4_svc(NLM4_TESTargs *, struct svc_req *); +#define NLM4_LOCK_MSG 7 +extern void * nlm4_lock_msg_4(NLM4_LOCKargs *, CLIENT *); +extern void * nlm4_lock_msg_4_svc(NLM4_LOCKargs *, struct svc_req *); +#define NLM4_CANCEL_MSG 8 +extern void * nlm4_cancel_msg_4(NLM4_CANCargs *, CLIENT *); +extern void * nlm4_cancel_msg_4_svc(NLM4_CANCargs *, struct svc_req *); +#define NLM4_UNLOCK_MSG 9 +extern void * nlm4_unlock_msg_4(NLM4_UNLOCKargs *, CLIENT *); +extern void * nlm4_unlock_msg_4_svc(NLM4_UNLOCKargs *, struct svc_req *); +#define NLM4_GRANT_MSG 10 +extern void * nlm4_grant_msg_4(NLM4_GRANTEDargs *, CLIENT *); +extern void * nlm4_grant_msg_4_svc(NLM4_GRANTEDargs *, struct svc_req *); +#define NLM4_TEST_RES 11 +extern void * nlm4_test_res_4(NLM4_TESTres *, CLIENT *); +extern void * nlm4_test_res_4_svc(NLM4_TESTres *, struct svc_req *); +#define NLM4_LOCK_RES 12 +extern void * nlm4_lock_res_4(NLM4_LOCKres *, CLIENT *); +extern void * nlm4_lock_res_4_svc(NLM4_LOCKres *, struct svc_req *); +#define NLM4_CANCEL_RES 13 +extern void * nlm4_cancel_res_4(NLM4_CANCres *, CLIENT *); +extern void * nlm4_cancel_res_4_svc(NLM4_CANCres *, struct svc_req *); +#define NLM4_UNLOCK_RES 14 +extern void * nlm4_unlock_res_4(NLM4_UNLOCKres *, CLIENT *); +extern void * nlm4_unlock_res_4_svc(NLM4_UNLOCKres *, struct svc_req *); +#define NLM4_GRANT_RES 15 +extern void * nlm4_grant_res_4(NLM4_GRANTEDres *, CLIENT *); +extern void * nlm4_grant_res_4_svc(NLM4_GRANTEDres *, struct svc_req *); +extern int nlm_program_4_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define NLM4_NULL 0 +extern void * nlm4_null_4(); +extern void * nlm4_null_4_svc(); +#define NLM4_TEST 1 +extern NLM4_TESTres * nlm4_test_4(); +extern NLM4_TESTres * nlm4_test_4_svc(); +#define NLM4_LOCK 2 +extern NLM4_LOCKres * nlm4_lock_4(); +extern NLM4_LOCKres * nlm4_lock_4_svc(); +#define NLM4_CANCEL 3 +extern NLM4_CANCres * nlm4_cancel_4(); +extern NLM4_CANCres * nlm4_cancel_4_svc(); +#define NLM4_UNLOCK 4 +extern NLM4_UNLOCKres * nlm4_unlock_4(); +extern NLM4_UNLOCKres * nlm4_unlock_4_svc(); +#define NLM4_GRANT 5 +extern NLM4_GRANTEDres * nlm4_grant_4(); +extern NLM4_GRANTEDres * nlm4_grant_4_svc(); +#define NLM4_TEST_MSG 6 +extern void * nlm4_test_msg_4(); +extern void * nlm4_test_msg_4_svc(); +#define NLM4_LOCK_MSG 7 +extern void * nlm4_lock_msg_4(); +extern void * nlm4_lock_msg_4_svc(); +#define NLM4_CANCEL_MSG 8 +extern void * nlm4_cancel_msg_4(); +extern void * nlm4_cancel_msg_4_svc(); +#define NLM4_UNLOCK_MSG 9 +extern void * nlm4_unlock_msg_4(); +extern void * nlm4_unlock_msg_4_svc(); +#define NLM4_GRANT_MSG 10 +extern void * nlm4_grant_msg_4(); +extern void * nlm4_grant_msg_4_svc(); +#define NLM4_TEST_RES 11 +extern void * nlm4_test_res_4(); +extern void * nlm4_test_res_4_svc(); +#define NLM4_LOCK_RES 12 +extern void * nlm4_lock_res_4(); +extern void * nlm4_lock_res_4_svc(); +#define NLM4_CANCEL_RES 13 +extern void * nlm4_cancel_res_4(); +extern void * nlm4_cancel_res_4_svc(); +#define NLM4_UNLOCK_RES 14 +extern void * nlm4_unlock_res_4(); +extern void * nlm4_unlock_res_4_svc(); +#define NLM4_GRANT_RES 15 +extern void * nlm4_grant_res_4(); +extern void * nlm4_grant_res_4_svc(); +extern int nlm_program_4_freeresult (); +#endif /* K&R C */ + +/* the zdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t zdr_nlm_fh4 (ZDR *, nlm_fh4*); +extern bool_t zdr_nlm4_oh (ZDR *, nlm4_oh*); +extern bool_t zdr_nlm_cookie (ZDR *, nlm_cookie*); +extern bool_t zdr_nlmstat4 (ZDR *, nlmstat4*); +extern bool_t zdr_nlm4_holder (ZDR *, nlm4_holder*); +extern bool_t zdr_nlm4_lock (ZDR *, nlm4_lock*); +extern bool_t zdr_nlm4_share (ZDR *, nlm4_share*); +extern bool_t zdr_nlm4_testres_denied (ZDR *, nlm4_testres_denied*); +extern bool_t zdr_nlm4_testreply (ZDR *, nlm4_testreply*); +extern bool_t zdr_NLM4_TESTres (ZDR *, NLM4_TESTres*); +extern bool_t zdr_NLM4_TESTargs (ZDR *, NLM4_TESTargs*); +extern bool_t zdr_NLM4_CANCres (ZDR *, NLM4_CANCres*); +extern bool_t zdr_NLM4_CANCargs (ZDR *, NLM4_CANCargs*); +extern bool_t zdr_NLM4_UNLOCKres (ZDR *, NLM4_UNLOCKres*); +extern bool_t zdr_NLM4_UNLOCKargs (ZDR *, NLM4_UNLOCKargs*); +extern bool_t zdr_NLM4_LOCKres (ZDR *, NLM4_LOCKres*); +extern bool_t zdr_NLM4_LOCKargs (ZDR *, NLM4_LOCKargs*); +extern bool_t zdr_NLM4_GRANTEDargs (ZDR *, NLM4_GRANTEDargs*); +extern bool_t zdr_NLM4_GRANTEDres (ZDR *, NLM4_GRANTEDres*); + +#else /* K&R C */ +extern bool_t zdr_nlm_fh4 (); +extern bool_t zdr_nlm4_oh (); +extern bool_t zdr_nlm_cookie (); +extern bool_t zdr_nlmstat4 (); +extern bool_t zdr_nlm4_holder (); +extern bool_t zdr_nlm4_lock (); +extern bool_t zdr_nlm4_share (); +extern bool_t zdr_nlm4_testres_denied (); +extern bool_t zdr_nlm4_testreply (); +extern bool_t zdr_NLM4_TESTres (); +extern bool_t zdr_NLM4_TESTargs (); +extern bool_t zdr_NLM4_CANCres (); +extern bool_t zdr_NLM4_CANCargs (); +extern bool_t zdr_NLM4_UNLOCKres (); +extern bool_t zdr_NLM4_UNLOCKargs (); +extern bool_t zdr_NLM4_LOCKres (); +extern bool_t zdr_NLM4_LOCKargs (); +extern bool_t zdr_NLM4_GRANTEDargs (); +extern bool_t zdr_NLM4_GRANTEDres (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NLM_H_RPCGEN */ diff --git a/nlm/nlm.c b/nlm/nlm.c index b8f5b31..46ddbb7 100644 --- a/nlm/nlm.c +++ b/nlm/nlm.c @@ -21,8 +21,7 @@ #include #include -#include -#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" @@ -32,7 +31,7 @@ int rpc_nlm4_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_NULL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_NULL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/null call"); return -1; @@ -51,14 +50,14 @@ int rpc_nlm4_test_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_TESTargs { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_TEST, cb, private_data, (xdrproc_t)xdr_NLM4_TESTres, sizeof(NLM4_TESTres)); + pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_TEST, cb, private_data, (zdrproc_t)zdr_NLM4_TESTres, sizeof(NLM4_TESTres)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/test call"); return -1; } - if (xdr_NLM4_TESTargs(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode NLM4_TESTargs"); + if (zdr_NLM4_TESTargs(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode NLM4_TESTargs"); rpc_free_pdu(rpc, pdu); return -2; } @@ -76,14 +75,14 @@ int rpc_nlm4_lock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_LOCKargs { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_LOCK, cb, private_data, (xdrproc_t)xdr_NLM4_LOCKres, sizeof(NLM4_LOCKres)); + pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_LOCK, cb, private_data, (zdrproc_t)zdr_NLM4_LOCKres, sizeof(NLM4_LOCKres)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/lock call"); return -1; } - if (xdr_NLM4_LOCKargs(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode NLM4_LOCKargs"); + if (zdr_NLM4_LOCKargs(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode NLM4_LOCKargs"); rpc_free_pdu(rpc, pdu); return -2; } @@ -101,14 +100,14 @@ int rpc_nlm4_cancel_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_CANCar { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_CANCEL, cb, private_data, (xdrproc_t)xdr_NLM4_CANCres, sizeof(NLM4_CANCres)); + pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_CANCEL, cb, private_data, (zdrproc_t)zdr_NLM4_CANCres, sizeof(NLM4_CANCres)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/cancel call"); return -1; } - if (xdr_NLM4_CANCargs(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode NLM4_CANCargs"); + if (zdr_NLM4_CANCargs(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode NLM4_CANCargs"); rpc_free_pdu(rpc, pdu); return -2; } @@ -126,14 +125,14 @@ int rpc_nlm4_unlock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_UNLOCK { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_UNLOCK, cb, private_data, (xdrproc_t)xdr_NLM4_UNLOCKres, sizeof(NLM4_UNLOCKres)); + pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_UNLOCK, cb, private_data, (zdrproc_t)zdr_NLM4_UNLOCKres, sizeof(NLM4_UNLOCKres)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/unlock call"); return -1; } - if (xdr_NLM4_UNLOCKargs(&pdu->xdr, args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode NLM4_UNLOCKargs"); + if (zdr_NLM4_UNLOCKargs(&pdu->zdr, args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode NLM4_UNLOCKargs"); rpc_free_pdu(rpc, pdu); return -2; } diff --git a/portmap/Makefile.am b/portmap/Makefile.am index 6280338..794c2c6 100644 --- a/portmap/Makefile.am +++ b/portmap/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libportmap.la -portmap_SOURCES_GENERATED = libnfs-raw-portmap.c -portmap_HEADERS_GENERATED = libnfs-raw-portmap.h +portmap_SOURCES_GENERATED = +portmap_HEADERS_GENERATED = portmap_GENERATED = $(portmap_SOURCES_GENERATED) $(portmap_HEADERS_GENERATED) CLEANFILES = $(portmap_GENERATED) portmap-stamp @@ -9,12 +9,13 @@ CLEANFILES = $(portmap_GENERATED) portmap-stamp libportmap_la_CPPFLAGS = -I$(abs_top_srcdir)/include libportmap_la_SOURCES = \ $(portmap_SOURCES_GENERATED) \ - portmap.c + portmap.c libnfs-raw-portmap.c $(portmap_GENERATED) : portmap-stamp portmap-stamp : portmap.x rm -f $(portmap_GENERATED) - rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-portmap.h - rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > libnfs-raw-portmap.c touch portmap-stamp - + +compile_rpc: + rpcgen -h @RPCGENFLAGS@ portmap.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-portmap.h + rpcgen -c @RPCGENFLAGS@ portmap.x | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-zdr.h\"\n#include \"libnfs-raw-portmap.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-portmap.c diff --git a/portmap/libnfs-raw-portmap.c b/portmap/libnfs-raw-portmap.c new file mode 100644 index 0000000..c3f094f --- /dev/null +++ b/portmap/libnfs-raw-portmap.c @@ -0,0 +1,129 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "libnfs-zdr.h" +#include "libnfs-raw-portmap.h" + +bool_t +zdr_pmap_mapping (ZDR *zdrs, pmap_mapping *objp) +{ + register int32_t *buf; + + + if (zdrs->x_op == ZDR_ENCODE) { + buf = ZDR_INLINE (zdrs, 4 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->prog)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->vers)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->prot)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->port)) + return FALSE; + } else { + IZDR_PUT_U_LONG(buf, objp->prog); + IZDR_PUT_U_LONG(buf, objp->vers); + IZDR_PUT_U_LONG(buf, objp->prot); + IZDR_PUT_U_LONG(buf, objp->port); + } + return TRUE; + } else if (zdrs->x_op == ZDR_DECODE) { + buf = ZDR_INLINE (zdrs, 4 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->prog)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->vers)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->prot)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->port)) + return FALSE; + } else { + objp->prog = IZDR_GET_U_LONG(buf); + objp->vers = IZDR_GET_U_LONG(buf); + objp->prot = IZDR_GET_U_LONG(buf); + objp->port = IZDR_GET_U_LONG(buf); + } + return TRUE; + } + + if (!zdr_u_int (zdrs, &objp->prog)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->vers)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->prot)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->port)) + return FALSE; + return TRUE; +} + +bool_t +zdr_pmap_call_args (ZDR *zdrs, pmap_call_args *objp) +{ + register int32_t *buf; + + + if (zdrs->x_op == ZDR_ENCODE) { + buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->prog)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->vers)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->proc)) + return FALSE; + + } else { + IZDR_PUT_U_LONG(buf, objp->prog); + IZDR_PUT_U_LONG(buf, objp->vers); + IZDR_PUT_U_LONG(buf, objp->proc); + } + if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0)) + return FALSE; + return TRUE; + } else if (zdrs->x_op == ZDR_DECODE) { + buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_u_int (zdrs, &objp->prog)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->vers)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->proc)) + return FALSE; + + } else { + objp->prog = IZDR_GET_U_LONG(buf); + objp->vers = IZDR_GET_U_LONG(buf); + objp->proc = IZDR_GET_U_LONG(buf); + } + if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0)) + return FALSE; + return TRUE; + } + + if (!zdr_u_int (zdrs, &objp->prog)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->vers)) + return FALSE; + if (!zdr_u_int (zdrs, &objp->proc)) + return FALSE; + if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +zdr_pmap_call_result (ZDR *zdrs, pmap_call_result *objp) +{ + register int32_t *buf; + + if (!zdr_u_int (zdrs, &objp->port)) + return FALSE; + if (!zdr_bytes (zdrs, (char **)&objp->res.res_val, (u_int *) &objp->res.res_len, ~0)) + return FALSE; + return TRUE; +} diff --git a/portmap/libnfs-raw-portmap.h b/portmap/libnfs-raw-portmap.h new file mode 100644 index 0000000..2af2e48 --- /dev/null +++ b/portmap/libnfs-raw-portmap.h @@ -0,0 +1,104 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _PORTMAP_H_RPCGEN +#define _PORTMAP_H_RPCGEN + + + + +#ifdef __cplusplus +extern "C" { +#endif + +#define PMAP_PORT 111 + +struct pmap_mapping { + u_int prog; + u_int vers; + u_int prot; + u_int port; +}; +typedef struct pmap_mapping pmap_mapping; + +struct pmap_call_args { + u_int prog; + u_int vers; + u_int proc; + struct { + u_int args_len; + char *args_val; + } args; +}; +typedef struct pmap_call_args pmap_call_args; + +struct pmap_call_result { + u_int port; + struct { + u_int res_len; + char *res_val; + } res; +}; +typedef struct pmap_call_result pmap_call_result; + +#define PMAP_PROGRAM 100000 +#define PMAP_V2 2 + +#if defined(__STDC__) || defined(__cplusplus) +#define PMAP_NULL 0 +extern void * pmap_null_2(void *, CLIENT *); +extern void * pmap_null_2_svc(void *, struct svc_req *); +#define PMAP_SET 1 +extern bool_t * pmap_set_2(pmap_mapping *, CLIENT *); +extern bool_t * pmap_set_2_svc(pmap_mapping *, struct svc_req *); +#define PMAP_UNSET 2 +extern bool_t * pmap_unset_2(pmap_mapping *, CLIENT *); +extern bool_t * pmap_unset_2_svc(pmap_mapping *, struct svc_req *); +#define PMAP_GETPORT 3 +extern u_int * pmap_getport_2(pmap_mapping *, CLIENT *); +extern u_int * pmap_getport_2_svc(pmap_mapping *, struct svc_req *); +#define PMAP_CALLIT 5 +extern pmap_call_result * pmap_callit_2(pmap_call_args *, CLIENT *); +extern pmap_call_result * pmap_callit_2_svc(pmap_call_args *, struct svc_req *); +extern int pmap_program_2_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define PMAP_NULL 0 +extern void * pmap_null_2(); +extern void * pmap_null_2_svc(); +#define PMAP_SET 1 +extern bool_t * pmap_set_2(); +extern bool_t * pmap_set_2_svc(); +#define PMAP_UNSET 2 +extern bool_t * pmap_unset_2(); +extern bool_t * pmap_unset_2_svc(); +#define PMAP_GETPORT 3 +extern u_int * pmap_getport_2(); +extern u_int * pmap_getport_2_svc(); +#define PMAP_CALLIT 5 +extern pmap_call_result * pmap_callit_2(); +extern pmap_call_result * pmap_callit_2_svc(); +extern int pmap_program_2_freeresult (); +#endif /* K&R C */ + +/* the zdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t zdr_pmap_mapping (ZDR *, pmap_mapping*); +extern bool_t zdr_pmap_call_args (ZDR *, pmap_call_args*); +extern bool_t zdr_pmap_call_result (ZDR *, pmap_call_result*); + +#else /* K&R C */ +extern bool_t zdr_pmap_mapping (); +extern bool_t zdr_pmap_call_args (); +extern bool_t zdr_pmap_call_result (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_PORTMAP_H_RPCGEN */ diff --git a/portmap/portmap.c b/portmap/portmap.c index c7820d0..aa92fea 100644 --- a/portmap/portmap.c +++ b/portmap/portmap.c @@ -19,8 +19,7 @@ #endif/*WIN32*/ #include -#include -#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" @@ -31,7 +30,7 @@ int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_NULL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_NULL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/null call"); return -1; @@ -51,7 +50,7 @@ int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, in struct rpc_pdu *pdu; struct pmap_mapping m; - pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_GETPORT, cb, private_data, (xdrproc_t)xdr_int, sizeof(uint32_t)); + pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_GETPORT, cb, private_data, (zdrproc_t)zdr_int, sizeof(uint32_t)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/getport call"); return -1; @@ -61,8 +60,8 @@ int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, in m.vers = version; m.prot = protocol; m.port = 0; - if (xdr_pmap_mapping(&pdu->xdr, &m) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode data for portmap/getport call"); + if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/getport call"); rpc_free_pdu(rpc, pdu); return -1; } @@ -81,7 +80,7 @@ int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int pr struct rpc_pdu *pdu; struct pmap_mapping m; - pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_SET, cb, private_data, (xdrproc_t)xdr_int, sizeof(uint32_t)); + pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_SET, cb, private_data, (zdrproc_t)zdr_int, sizeof(uint32_t)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/set call"); return -1; @@ -91,8 +90,8 @@ int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int pr m.vers = version; m.prot = protocol; m.port = port; - if (xdr_pmap_mapping(&pdu->xdr, &m) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode data for portmap/set call"); + if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/set call"); rpc_free_pdu(rpc, pdu); return -1; } @@ -111,7 +110,7 @@ int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int struct rpc_pdu *pdu; struct pmap_mapping m; - pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_UNSET, cb, private_data, (xdrproc_t)xdr_int, sizeof(uint32_t)); + pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_UNSET, cb, private_data, (zdrproc_t)zdr_int, sizeof(uint32_t)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/unset call"); return -1; @@ -121,8 +120,8 @@ int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int m.vers = version; m.prot = protocol; m.port = port; - if (xdr_pmap_mapping(&pdu->xdr, &m) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode data for portmap/unset call"); + if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/unset call"); rpc_free_pdu(rpc, pdu); return -1; } @@ -141,7 +140,7 @@ int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int struct rpc_pdu *pdu; struct pmap_call_args ca; - pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_CALLIT, cb, private_data, (xdrproc_t)xdr_pmap_call_result, sizeof(pmap_call_result)); + pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_CALLIT, cb, private_data, (zdrproc_t)zdr_pmap_call_result, sizeof(pmap_call_result)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/callit call"); return -1; @@ -153,8 +152,8 @@ int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int ca.args.args_len = datalen; ca.args.args_val = data; - if (xdr_pmap_call_args(&pdu->xdr, &ca) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode data for portmap/callit call"); + if (zdr_pmap_call_args(&pdu->zdr, &ca) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/callit call"); rpc_free_pdu(rpc, pdu); return -1; } diff --git a/rquota/Makefile.am b/rquota/Makefile.am index da22cea..fe3f37d 100644 --- a/rquota/Makefile.am +++ b/rquota/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = librquota.la -rquota_SOURCES_GENERATED = libnfs-raw-rquota.c -rquota_HEADERS_GENERATED = libnfs-raw-rquota.h +rquota_SOURCES_GENERATED = +rquota_HEADERS_GENERATED = rquota_GENERATED = $(rquota_SOURCES_GENERATED) $(rquota_HEADERS_GENERATED) CLEANFILES = $(rquota_GENERATED) rquota-stamp @@ -9,12 +9,13 @@ CLEANFILES = $(rquota_GENERATED) rquota-stamp librquota_la_CPPFLAGS = -I$(abs_top_srcdir)/include librquota_la_SOURCES = \ $(rquota_SOURCES_GENERATED) \ - rquota.c + rquota.c libnfs-raw-rquota.c $(rquota_GENERATED) : rquota-stamp rquota-stamp : rquota.x rm -f $(rquota_GENERATED) - rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-rquota.h - rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-raw-rquota.h\"/" > libnfs-raw-rquota.c touch rquota-stamp +compile_rpc: + rpcgen -h @RPCGENFLAGS@ rquota.x | sed -e "s/#include //" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-rquota.h + rpcgen -c @RPCGENFLAGS@ rquota.x | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-rquota.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-rquota.c diff --git a/rquota/libnfs-raw-rquota.c b/rquota/libnfs-raw-rquota.c new file mode 100644 index 0000000..da246dd --- /dev/null +++ b/rquota/libnfs-raw-rquota.c @@ -0,0 +1,184 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "libnfs-zdr.h" +#include "libnfs-raw-rquota.h" + +bool_t +zdr_rquotastat (ZDR *zdrs, rquotastat *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_exportpath (ZDR *zdrs, exportpath *objp) +{ + register int32_t *buf; + + if (!zdr_string (zdrs, objp, RQUOTAPATHLEN)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETQUOTA1args (ZDR *zdrs, GETQUOTA1args *objp) +{ + register int32_t *buf; + + if (!zdr_exportpath (zdrs, &objp->export)) + return FALSE; + if (!zdr_int (zdrs, &objp->uid)) + return FALSE; + return TRUE; +} + +bool_t +zdr_quotatype (ZDR *zdrs, quotatype *objp) +{ + register int32_t *buf; + + if (!zdr_enum (zdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETQUOTA2args (ZDR *zdrs, GETQUOTA2args *objp) +{ + register int32_t *buf; + + if (!zdr_exportpath (zdrs, &objp->export)) + return FALSE; + if (!zdr_quotatype (zdrs, &objp->type)) + return FALSE; + if (!zdr_int (zdrs, &objp->uid)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETQUOTA1res_ok (ZDR *zdrs, GETQUOTA1res_ok *objp) +{ + register int32_t *buf; + + + if (zdrs->x_op == ZDR_ENCODE) { + buf = ZDR_INLINE (zdrs, 10 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_int (zdrs, &objp->bsize)) + return FALSE; + if (!zdr_int (zdrs, &objp->active)) + return FALSE; + if (!zdr_int (zdrs, &objp->bhardlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->bsoftlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->curblocks)) + return FALSE; + if (!zdr_int (zdrs, &objp->fhardlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->fsoftlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->curfiles)) + return FALSE; + if (!zdr_int (zdrs, &objp->btimeleft)) + return FALSE; + if (!zdr_int (zdrs, &objp->ftimeleft)) + return FALSE; + } else { + IZDR_PUT_LONG(buf, objp->bsize); + IZDR_PUT_LONG(buf, objp->active); + IZDR_PUT_LONG(buf, objp->bhardlimit); + IZDR_PUT_LONG(buf, objp->bsoftlimit); + IZDR_PUT_LONG(buf, objp->curblocks); + IZDR_PUT_LONG(buf, objp->fhardlimit); + IZDR_PUT_LONG(buf, objp->fsoftlimit); + IZDR_PUT_LONG(buf, objp->curfiles); + IZDR_PUT_LONG(buf, objp->btimeleft); + IZDR_PUT_LONG(buf, objp->ftimeleft); + } + return TRUE; + } else if (zdrs->x_op == ZDR_DECODE) { + buf = ZDR_INLINE (zdrs, 10 * BYTES_PER_ZDR_UNIT); + if (buf == NULL) { + if (!zdr_int (zdrs, &objp->bsize)) + return FALSE; + if (!zdr_int (zdrs, &objp->active)) + return FALSE; + if (!zdr_int (zdrs, &objp->bhardlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->bsoftlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->curblocks)) + return FALSE; + if (!zdr_int (zdrs, &objp->fhardlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->fsoftlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->curfiles)) + return FALSE; + if (!zdr_int (zdrs, &objp->btimeleft)) + return FALSE; + if (!zdr_int (zdrs, &objp->ftimeleft)) + return FALSE; + } else { + objp->bsize = IZDR_GET_LONG(buf); + objp->active = IZDR_GET_LONG(buf); + objp->bhardlimit = IZDR_GET_LONG(buf); + objp->bsoftlimit = IZDR_GET_LONG(buf); + objp->curblocks = IZDR_GET_LONG(buf); + objp->fhardlimit = IZDR_GET_LONG(buf); + objp->fsoftlimit = IZDR_GET_LONG(buf); + objp->curfiles = IZDR_GET_LONG(buf); + objp->btimeleft = IZDR_GET_LONG(buf); + objp->ftimeleft = IZDR_GET_LONG(buf); + } + return TRUE; + } + + if (!zdr_int (zdrs, &objp->bsize)) + return FALSE; + if (!zdr_int (zdrs, &objp->active)) + return FALSE; + if (!zdr_int (zdrs, &objp->bhardlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->bsoftlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->curblocks)) + return FALSE; + if (!zdr_int (zdrs, &objp->fhardlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->fsoftlimit)) + return FALSE; + if (!zdr_int (zdrs, &objp->curfiles)) + return FALSE; + if (!zdr_int (zdrs, &objp->btimeleft)) + return FALSE; + if (!zdr_int (zdrs, &objp->ftimeleft)) + return FALSE; + return TRUE; +} + +bool_t +zdr_GETQUOTA1res (ZDR *zdrs, GETQUOTA1res *objp) +{ + register int32_t *buf; + + if (!zdr_rquotastat (zdrs, &objp->status)) + return FALSE; + switch (objp->status) { + case RQUOTA_OK: + if (!zdr_GETQUOTA1res_ok (zdrs, &objp->GETQUOTA1res_u.quota)) + return FALSE; + break; + default: + break; + } + return TRUE; +} diff --git a/rquota/libnfs-raw-rquota.h b/rquota/libnfs-raw-rquota.h new file mode 100644 index 0000000..0cb42fa --- /dev/null +++ b/rquota/libnfs-raw-rquota.h @@ -0,0 +1,148 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _RQUOTA_H_RPCGEN +#define _RQUOTA_H_RPCGEN + + + + +#ifdef __cplusplus +extern "C" { +#endif + +#define RQUOTAPATHLEN 1024 + +enum rquotastat { + RQUOTA_OK = 1, + RQUOTA_NOQUOTA = 2, + RQUOTA_EPERM = 3, +}; +typedef enum rquotastat rquotastat; + +typedef char *exportpath; + +struct GETQUOTA1args { + exportpath export; + int uid; +}; +typedef struct GETQUOTA1args GETQUOTA1args; + +enum quotatype { + RQUOTA_TYPE_UID = 0, + RQUOTA_TYPE_GID = 1, +}; +typedef enum quotatype quotatype; + +struct GETQUOTA2args { + exportpath export; + quotatype type; + int uid; +}; +typedef struct GETQUOTA2args GETQUOTA2args; + +struct GETQUOTA1res_ok { + int bsize; + int active; + int bhardlimit; + int bsoftlimit; + int curblocks; + int fhardlimit; + int fsoftlimit; + int curfiles; + int btimeleft; + int ftimeleft; +}; +typedef struct GETQUOTA1res_ok GETQUOTA1res_ok; + +struct GETQUOTA1res { + rquotastat status; + union { + GETQUOTA1res_ok quota; + } GETQUOTA1res_u; +}; +typedef struct GETQUOTA1res GETQUOTA1res; + +#define RQUOTA_PROGRAM 100011 +#define RQUOTA_V1 1 + +#if defined(__STDC__) || defined(__cplusplus) +#define RQUOTA1_NULL 0 +extern void * rquota1_null_1(void *, CLIENT *); +extern void * rquota1_null_1_svc(void *, struct svc_req *); +#define RQUOTA1_GETQUOTA 1 +extern GETQUOTA1res * rquota1_getquota_1(GETQUOTA1args *, CLIENT *); +extern GETQUOTA1res * rquota1_getquota_1_svc(GETQUOTA1args *, struct svc_req *); +#define RQUOTA1_GETACTIVEQUOTA 2 +extern GETQUOTA1res * rquota1_getactivequota_1(GETQUOTA1args *, CLIENT *); +extern GETQUOTA1res * rquota1_getactivequota_1_svc(GETQUOTA1args *, struct svc_req *); +extern int rquota_program_1_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define RQUOTA1_NULL 0 +extern void * rquota1_null_1(); +extern void * rquota1_null_1_svc(); +#define RQUOTA1_GETQUOTA 1 +extern GETQUOTA1res * rquota1_getquota_1(); +extern GETQUOTA1res * rquota1_getquota_1_svc(); +#define RQUOTA1_GETACTIVEQUOTA 2 +extern GETQUOTA1res * rquota1_getactivequota_1(); +extern GETQUOTA1res * rquota1_getactivequota_1_svc(); +extern int rquota_program_1_freeresult (); +#endif /* K&R C */ +#define RQUOTA_V2 2 + +#if defined(__STDC__) || defined(__cplusplus) +#define RQUOTA2_NULL 0 +extern void * rquota2_null_2(void *, CLIENT *); +extern void * rquota2_null_2_svc(void *, struct svc_req *); +#define RQUOTA2_GETQUOTA 1 +extern GETQUOTA1res * rquota2_getquota_2(GETQUOTA2args *, CLIENT *); +extern GETQUOTA1res * rquota2_getquota_2_svc(GETQUOTA2args *, struct svc_req *); +#define RQUOTA2_GETACTIVEQUOTA 2 +extern GETQUOTA1res * rquota2_getactivequota_2(GETQUOTA2args *, CLIENT *); +extern GETQUOTA1res * rquota2_getactivequota_2_svc(GETQUOTA2args *, struct svc_req *); +extern int rquota_program_2_freeresult (SVCXPRT *, zdrproc_t, caddr_t); + +#else /* K&R C */ +#define RQUOTA2_NULL 0 +extern void * rquota2_null_2(); +extern void * rquota2_null_2_svc(); +#define RQUOTA2_GETQUOTA 1 +extern GETQUOTA1res * rquota2_getquota_2(); +extern GETQUOTA1res * rquota2_getquota_2_svc(); +#define RQUOTA2_GETACTIVEQUOTA 2 +extern GETQUOTA1res * rquota2_getactivequota_2(); +extern GETQUOTA1res * rquota2_getactivequota_2_svc(); +extern int rquota_program_2_freeresult (); +#endif /* K&R C */ + +/* the zdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t zdr_rquotastat (ZDR *, rquotastat*); +extern bool_t zdr_exportpath (ZDR *, exportpath*); +extern bool_t zdr_GETQUOTA1args (ZDR *, GETQUOTA1args*); +extern bool_t zdr_quotatype (ZDR *, quotatype*); +extern bool_t zdr_GETQUOTA2args (ZDR *, GETQUOTA2args*); +extern bool_t zdr_GETQUOTA1res_ok (ZDR *, GETQUOTA1res_ok*); +extern bool_t zdr_GETQUOTA1res (ZDR *, GETQUOTA1res*); + +#else /* K&R C */ +extern bool_t zdr_rquotastat (); +extern bool_t zdr_exportpath (); +extern bool_t zdr_GETQUOTA1args (); +extern bool_t zdr_quotatype (); +extern bool_t zdr_GETQUOTA2args (); +extern bool_t zdr_GETQUOTA1res_ok (); +extern bool_t zdr_GETQUOTA1res (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_RQUOTA_H_RPCGEN */ diff --git a/rquota/rquota.c b/rquota/rquota.c index 549f2ff..ec19d61 100644 --- a/rquota/rquota.c +++ b/rquota/rquota.c @@ -21,8 +21,7 @@ #include #include #include -#include -#include +#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" @@ -55,7 +54,7 @@ int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_dat { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V1, RQUOTA1_NULL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V1, RQUOTA1_NULL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for rquota1/null call"); return -1; @@ -75,7 +74,7 @@ int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, struct rpc_pdu *pdu; GETQUOTA1args args; - pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V1, RQUOTA1_GETQUOTA, cb, private_data, (xdrproc_t)xdr_GETQUOTA1res, sizeof(GETQUOTA1res)); + pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V1, RQUOTA1_GETQUOTA, cb, private_data, (zdrproc_t)zdr_GETQUOTA1res, sizeof(GETQUOTA1res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for rquota1/getquota call"); return -1; @@ -84,8 +83,8 @@ int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, args.export = export; args.uid = uid; - if (xdr_GETQUOTA1args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode GETQUOTA1args"); + if (zdr_GETQUOTA1args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode GETQUOTA1args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -104,7 +103,7 @@ int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *e struct rpc_pdu *pdu; GETQUOTA1args args; - pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V1, RQUOTA1_GETACTIVEQUOTA, cb, private_data, (xdrproc_t)xdr_GETQUOTA1res, sizeof(GETQUOTA1res)); + pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V1, RQUOTA1_GETACTIVEQUOTA, cb, private_data, (zdrproc_t)zdr_GETQUOTA1res, sizeof(GETQUOTA1res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for rquota1/getactivequota call"); return -1; @@ -113,8 +112,8 @@ int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *e args.export = export; args.uid = uid; - if (xdr_GETQUOTA1args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode GETQUOTA1args"); + if (zdr_GETQUOTA1args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode GETQUOTA1args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -133,7 +132,7 @@ int rpc_rquota2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_dat { struct rpc_pdu *pdu; - pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V2, RQUOTA2_NULL, cb, private_data, (xdrproc_t)xdr_void, 0); + pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V2, RQUOTA2_NULL, cb, private_data, (zdrproc_t)zdr_void, 0); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for rquota2/null call"); return -1; @@ -153,7 +152,7 @@ int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, struct rpc_pdu *pdu; GETQUOTA2args args; - pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V2, RQUOTA2_GETQUOTA, cb, private_data, (xdrproc_t)xdr_GETQUOTA1res, sizeof(GETQUOTA1res)); + pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V2, RQUOTA2_GETQUOTA, cb, private_data, (zdrproc_t)zdr_GETQUOTA1res, sizeof(GETQUOTA1res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for rquota2/getquota call"); return -1; @@ -163,8 +162,8 @@ int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, args.type = type; args.uid = uid; - if (xdr_GETQUOTA2args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode GETQUOTA2args"); + if (zdr_GETQUOTA2args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode GETQUOTA2args"); rpc_free_pdu(rpc, pdu); return -2; } @@ -183,7 +182,7 @@ int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *e struct rpc_pdu *pdu; GETQUOTA2args args; - pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V2, RQUOTA2_GETACTIVEQUOTA, cb, private_data, (xdrproc_t)xdr_GETQUOTA1res, sizeof(GETQUOTA1res)); + pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V2, RQUOTA2_GETACTIVEQUOTA, cb, private_data, (zdrproc_t)zdr_GETQUOTA1res, sizeof(GETQUOTA1res)); if (pdu == NULL) { rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for rquota2/getactivequota call"); return -1; @@ -193,8 +192,8 @@ int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *e args.type = type; args.uid = uid; - if (xdr_GETQUOTA2args(&pdu->xdr, &args) == 0) { - rpc_set_error(rpc, "XDR error: Failed to encode GETQUOTA2args"); + if (zdr_GETQUOTA2args(&pdu->zdr, &args) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode GETQUOTA2args"); rpc_free_pdu(rpc, pdu); return -2; }