diff options
Diffstat (limited to 'rpc/xdr/src/rpc-common-xdr.c')
-rw-r--r-- | rpc/xdr/src/rpc-common-xdr.c | 232 |
1 files changed, 232 insertions, 0 deletions
diff --git a/rpc/xdr/src/rpc-common-xdr.c b/rpc/xdr/src/rpc-common-xdr.c new file mode 100644 index 00000000000..14ddea71537 --- /dev/null +++ b/rpc/xdr/src/rpc-common-xdr.c @@ -0,0 +1,232 @@ +/* + Copyright (c) 2007-2011 Gluster, Inc. <http://www.gluster.com> + This file is part of GlusterFS. + + GlusterFS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + GlusterFS 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + <http://www.gnu.org/licenses/>. +*/ + +#include "xdr-common.h" +#include "compat.h" + +#if defined(__GNUC__) +#if __GNUC__ >= 4 +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif +#endif + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "rpc-common-xdr.h" + +bool_t +xdr_auth_glusterfs_parms_v2 (XDR *xdrs, auth_glusterfs_parms_v2 *objp) +{ + register int32_t *buf; + buf = NULL; + + + if (xdrs->x_op == XDR_ENCODE) { + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + + } else { + IXDR_PUT_LONG(buf, objp->pid); + IXDR_PUT_U_LONG(buf, objp->uid); + IXDR_PUT_U_LONG(buf, objp->gid); + } + if (!xdr_array (xdrs, (char **)&objp->groups.groups_val, (u_int *) &objp->groups.groups_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->lk_owner.lk_owner_val, (u_int *) &objp->lk_owner.lk_owner_len, ~0)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + + } else { + objp->pid = IXDR_GET_LONG(buf); + objp->uid = IXDR_GET_U_LONG(buf); + objp->gid = IXDR_GET_U_LONG(buf); + } + if (!xdr_array (xdrs, (char **)&objp->groups.groups_val, (u_int *) &objp->groups.groups_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->lk_owner.lk_owner_val, (u_int *) &objp->lk_owner.lk_owner_len, ~0)) + return FALSE; + return TRUE; + } + + if (!xdr_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + if (!xdr_array (xdrs, (char **)&objp->groups.groups_val, (u_int *) &objp->groups.groups_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->lk_owner.lk_owner_val, (u_int *) &objp->lk_owner.lk_owner_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_auth_glusterfs_parms (XDR *xdrs, auth_glusterfs_parms *objp) +{ + register int32_t *buf; + int i; + buf = NULL; + + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_u_quad_t (xdrs, &objp->lk_owner)) + return FALSE; + buf = XDR_INLINE (xdrs, (4 + 16 )* BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ngrps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->groups, 16, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + } else { + IXDR_PUT_U_LONG(buf, objp->pid); + IXDR_PUT_U_LONG(buf, objp->uid); + IXDR_PUT_U_LONG(buf, objp->gid); + IXDR_PUT_U_LONG(buf, objp->ngrps); + { + register u_int *genp; + + for (i = 0, genp = objp->groups; + i < 16; ++i) { + IXDR_PUT_U_LONG(buf, *genp++); + } + } + } + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_u_quad_t (xdrs, &objp->lk_owner)) + return FALSE; + buf = XDR_INLINE (xdrs, (4 + 16 )* BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ngrps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->groups, 16, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + } else { + objp->pid = IXDR_GET_U_LONG(buf); + objp->uid = IXDR_GET_U_LONG(buf); + objp->gid = IXDR_GET_U_LONG(buf); + objp->ngrps = IXDR_GET_U_LONG(buf); + { + register u_int *genp; + + for (i = 0, genp = objp->groups; + i < 16; ++i) { + *genp++ = IXDR_GET_U_LONG(buf); + } + } + } + return TRUE; + } + + if (!xdr_u_quad_t (xdrs, &objp->lk_owner)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ngrps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->groups, 16, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_dump_req (XDR *xdrs, gf_dump_req *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_prog_detail (XDR *xdrs, gf_prog_detail *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_string (xdrs, &objp->progname, ~0)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->prognum)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->progver)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (gf_prog_detail), (xdrproc_t) xdr_gf_prog_detail)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_dump_rsp (XDR *xdrs, gf_dump_rsp *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->prog, sizeof (gf_prog_detail), (xdrproc_t) xdr_gf_prog_detail)) + return FALSE; + return TRUE; +} |