diff options
author | Krishna Srinivas <ksriniva@redhat.com> | 2012-02-20 14:34:39 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-20 07:26:51 -0800 |
commit | ed2036979499cb272336187c06955aa5e484023d (patch) | |
tree | a2173280ad5753aa4d674e86e6ed66bcdcd6f973 /rpc/xdr/src | |
parent | db20a0f8a99f715a77366e518720612f043d5c9e (diff) |
NLM - Network Lock Manger V4
Change-Id: Ic31b8bb10a28408da2a623f4ecc0c60af01c64af
BUG: 795421
Signed-off-by: Krishna Srinivas <ksriniva@redhat.com>
Reviewed-on: http://review.gluster.com/2711
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'rpc/xdr/src')
-rw-r--r-- | rpc/xdr/src/Makefile.am | 6 | ||||
-rw-r--r-- | rpc/xdr/src/msg-nfs3.c | 55 | ||||
-rw-r--r-- | rpc/xdr/src/msg-nfs3.h | 27 | ||||
-rw-r--r-- | rpc/xdr/src/nlm4-xdr.c | 243 | ||||
-rw-r--r-- | rpc/xdr/src/nlm4-xdr.h | 242 | ||||
-rw-r--r-- | rpc/xdr/src/nlm4.x | 158 | ||||
-rw-r--r-- | rpc/xdr/src/nlmcbk-xdr.c | 37 | ||||
-rw-r--r-- | rpc/xdr/src/nlmcbk-xdr.h | 74 | ||||
-rw-r--r-- | rpc/xdr/src/nlmcbk.x | 33 | ||||
-rw-r--r-- | rpc/xdr/src/nsm-xdr.c | 105 | ||||
-rw-r--r-- | rpc/xdr/src/nsm-xdr.h | 95 | ||||
-rw-r--r-- | rpc/xdr/src/nsm.x | 47 |
12 files changed, 1119 insertions, 3 deletions
diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am index 57c19338782..7174815b841 100644 --- a/rpc/xdr/src/Makefile.am +++ b/rpc/xdr/src/Makefile.am @@ -14,11 +14,13 @@ libgfxdr_la_SOURCES = xdr-generic.c rpc-common-xdr.c \ cli1-xdr.c \ glusterd1-xdr.c \ portmap-xdr.c \ - xdr-nfs3.c msg-nfs3.c + nlm4-xdr.c xdr-nfs3.c msg-nfs3.c nsm-xdr.c \ + nlmcbk-xdr.c noinst_HEADERS = xdr-generic.h rpc-common-xdr.h \ glusterfs3-xdr.h glusterfs3.h \ cli1-xdr.h \ glusterd1-xdr.h \ portmap-xdr.h \ - xdr-nfs3.h msg-nfs3.h + nlm4-xdr.h xdr-nfs3.h msg-nfs3.h nsm-xdr.h \ + nlmcbk-xdr.h diff --git a/rpc/xdr/src/msg-nfs3.c b/rpc/xdr/src/msg-nfs3.c index 5fc92123cee..f800b3128fa 100644 --- a/rpc/xdr/src/msg-nfs3.c +++ b/rpc/xdr/src/msg-nfs3.c @@ -474,4 +474,59 @@ xdr_serialize_nfsstat3 (struct iovec outmsg, nfsstat3 *s) (xdrproc_t)xdr_nfsstat3); } +ssize_t +xdr_to_nlm4_testargs (struct iovec inmsg, nlm4_testargs *args) +{ + return xdr_to_generic (inmsg, (void*)args, + (xdrproc_t)xdr_nlm4_testargs); +} + +ssize_t +xdr_serialize_nlm4_testres (struct iovec outmsg, nlm4_testres *res) +{ + return xdr_serialize_generic (outmsg, (void*)res, + (xdrproc_t)xdr_nlm4_testres); +} + +ssize_t +xdr_to_nlm4_lockargs (struct iovec inmsg, nlm4_lockargs *args) +{ + return xdr_to_generic (inmsg, (void*)args, + (xdrproc_t)xdr_nlm4_lockargs); +} + +ssize_t +xdr_serialize_nlm4_res (struct iovec outmsg, nlm4_res *res) +{ + return xdr_serialize_generic (outmsg, (void*)res, + (xdrproc_t)xdr_nlm4_res); +} + +ssize_t +xdr_to_nlm4_cancelargs (struct iovec inmsg, nlm4_cancargs *args) +{ + return xdr_to_generic (inmsg, (void*)args, + (xdrproc_t)xdr_nlm4_cancargs); +} + +ssize_t +xdr_to_nlm4_unlockargs (struct iovec inmsg, nlm4_unlockargs *args) +{ + return xdr_to_generic (inmsg, (void*)args, + (xdrproc_t)xdr_nlm4_unlockargs); +} + +ssize_t +xdr_serialize_nlm4_testargs (struct iovec outmsg, nlm4_testargs *args) +{ + return xdr_serialize_generic (outmsg, (void*)args, + (xdrproc_t)xdr_nlm4_testargs); +} + +ssize_t +xdr_to_nlm4_res (struct iovec inmsg, nlm4_res *args) +{ + return xdr_to_generic (inmsg, (void*)args, + (xdrproc_t)xdr_nlm4_res); +} diff --git a/rpc/xdr/src/msg-nfs3.h b/rpc/xdr/src/msg-nfs3.h index f828979e79f..1310e02f897 100644 --- a/rpc/xdr/src/msg-nfs3.h +++ b/rpc/xdr/src/msg-nfs3.h @@ -26,7 +26,7 @@ #endif #include "xdr-nfs3.h" - +#include "nlm4-xdr.h" #include <sys/types.h> #include <sys/uio.h> @@ -183,4 +183,29 @@ xdr_serialize_mountstat3 (struct iovec outmsg, mountstat3 *m); extern ssize_t xdr_serialize_nfsstat3 (struct iovec outmsg, nfsstat3 *s); + +extern ssize_t +xdr_to_nlm4_testargs (struct iovec inmsg, nlm4_testargs *args); + +extern ssize_t +xdr_serialize_nlm4_testres (struct iovec outmsg, nlm4_testres *res); + +extern ssize_t +xdr_to_nlm4_lockargs (struct iovec inmsg, nlm4_lockargs *args); + +extern ssize_t +xdr_serialize_nlm4_res (struct iovec outmsg, nlm4_res *res); + +extern ssize_t +xdr_to_nlm4_cancelargs (struct iovec inmsg, nlm4_cancargs *args); + +extern ssize_t +xdr_to_nlm4_unlockargs (struct iovec inmsg, nlm4_unlockargs *args); + +extern ssize_t +xdr_serialize_nlm4_testargs (struct iovec outmsg, nlm4_testargs *args); + +extern ssize_t +xdr_to_nlm4_res (struct iovec inmsg, nlm4_res *args); + #endif diff --git a/rpc/xdr/src/nlm4-xdr.c b/rpc/xdr/src/nlm4-xdr.c new file mode 100644 index 00000000000..b41fbb15cac --- /dev/null +++ b/rpc/xdr/src/nlm4-xdr.c @@ -0,0 +1,243 @@ +/* + Copyright (c) 2012 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/>. +*/ + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "nlm4-xdr.h" + +bool_t +xdr_netobj (XDR *xdrs, netobj *objp) +{ + if (!xdr_bytes (xdrs, (char **)&objp->n_bytes, (u_int *) &objp->n_len, MAXNETOBJ_SZ)) + return FALSE; + return TRUE; +} + +bool_t +xdr_fsh_mode (XDR *xdrs, fsh_mode *objp) +{ + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_fsh_access (XDR *xdrs, fsh_access *objp) +{ + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_stats (XDR *xdrs, nlm4_stats *objp) +{ + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_stat (XDR *xdrs, nlm4_stat *objp) +{ + if (!xdr_nlm4_stats (xdrs, &objp->stat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_holder (XDR *xdrs, nlm4_holder *objp) +{ + if (!xdr_bool (xdrs, &objp->exclusive)) + return FALSE; + if (!xdr_uint32_t (xdrs, &objp->svid)) + return FALSE; + if (!xdr_netobj (xdrs, &objp->oh)) + return FALSE; + if (!xdr_uint64_t (xdrs, &objp->l_offset)) + return FALSE; + if (!xdr_uint64_t (xdrs, &objp->l_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_lock (XDR *xdrs, nlm4_lock *objp) +{ + if (!xdr_string (xdrs, &objp->caller_name, MAXNAMELEN)) + return FALSE; + if (!xdr_netobj (xdrs, &objp->fh)) + return FALSE; + if (!xdr_netobj (xdrs, &objp->oh)) + return FALSE; + if (!xdr_uint32_t (xdrs, &objp->svid)) + return FALSE; + if (!xdr_uint64_t (xdrs, &objp->l_offset)) + return FALSE; + if (!xdr_uint64_t (xdrs, &objp->l_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_share (XDR *xdrs, nlm4_share *objp) +{ + if (!xdr_string (xdrs, &objp->caller_name, MAXNAMELEN)) + return FALSE; + if (!xdr_netobj (xdrs, &objp->fh)) + return FALSE; + if (!xdr_netobj (xdrs, &objp->oh)) + return FALSE; + if (!xdr_fsh_mode (xdrs, &objp->mode)) + return FALSE; + if (!xdr_fsh_access (xdrs, &objp->access)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_testrply (XDR *xdrs, nlm4_testrply *objp) +{ + if (!xdr_nlm4_stats (xdrs, &objp->stat)) + return FALSE; + switch (objp->stat) { + case nlm4_denied: + if (!xdr_nlm4_holder (xdrs, &objp->nlm4_testrply_u.holder)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_nlm4_testres (XDR *xdrs, nlm4_testres *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_nlm4_testrply (xdrs, &objp->stat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_testargs (XDR *xdrs, nlm4_testargs *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_bool (xdrs, &objp->exclusive)) + return FALSE; + if (!xdr_nlm4_lock (xdrs, &objp->alock)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_res (XDR *xdrs, nlm4_res *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_nlm4_stat (xdrs, &objp->stat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_lockargs (XDR *xdrs, nlm4_lockargs *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_bool (xdrs, &objp->block)) + return FALSE; + if (!xdr_bool (xdrs, &objp->exclusive)) + return FALSE; + if (!xdr_nlm4_lock (xdrs, &objp->alock)) + return FALSE; + if (!xdr_bool (xdrs, &objp->reclaim)) + return FALSE; + if (!xdr_int (xdrs, &objp->state)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_cancargs (XDR *xdrs, nlm4_cancargs *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_bool (xdrs, &objp->block)) + return FALSE; + if (!xdr_bool (xdrs, &objp->exclusive)) + return FALSE; + if (!xdr_nlm4_lock (xdrs, &objp->alock)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_unlockargs (XDR *xdrs, nlm4_unlockargs *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_nlm4_lock (xdrs, &objp->alock)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_shareargs (XDR *xdrs, nlm4_shareargs *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_nlm4_share (xdrs, &objp->share)) + return FALSE; + if (!xdr_bool (xdrs, &objp->reclaim)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nlm4_shareres (XDR *xdrs, nlm4_shareres *objp) +{ + if (!xdr_netobj (xdrs, &objp->cookie)) + return FALSE; + if (!xdr_nlm4_stats (xdrs, &objp->stat)) + return FALSE; + if (!xdr_int (xdrs, &objp->sequence)) + return FALSE; + return TRUE; +} + +/* +bool_t +xdr_nlm_sm_status (XDR *xdrs, nlm_sm_status *objp) +{ + if (!xdr_string (xdrs, &objp->mon_name, LM_MAXSTRLEN)) + return FALSE; + if (!xdr_int (xdrs, &objp->state)) + return FALSE; + if (!xdr_opaque (xdrs, objp->priv, 16)) + return FALSE; + return TRUE; +} +*/ diff --git a/rpc/xdr/src/nlm4-xdr.h b/rpc/xdr/src/nlm4-xdr.h new file mode 100644 index 00000000000..dd3e664bb4c --- /dev/null +++ b/rpc/xdr/src/nlm4-xdr.h @@ -0,0 +1,242 @@ +/* + Copyright (c) 2012 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/>. +*/ + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _NLM_H_RPCGEN +#define _NLM_H_RPCGEN + +#include <rpc/rpc.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAXNETOBJ_SZ 1024 +#define LM_MAXSTRLEN 1024 +#define MAXNAMELEN 1025 + +/* + * The following enums are actually bit encoded for efficient + * boolean algebra.... DON'T change them..... + */ + +enum fsh_mode { + fsm_DN = 0, + fsm_DR = 1, + fsm_DW = 2, + fsm_DRW = 3, +}; +typedef enum fsh_mode fsh_mode; + +enum fsh_access { + fsa_NONE = 0, + fsa_R = 1, + fsa_W = 2, + fsa_RW = 3, +}; +typedef enum fsh_access fsh_access; +/* definitions for NLM version 4 */ + +enum nlm4_stats { + nlm4_granted = 0, + nlm4_denied = 1, + nlm4_denied_nolock = 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 nlm4_stats nlm4_stats; + +struct nlm4_stat { + nlm4_stats stat; +}; +typedef struct nlm4_stat nlm4_stat; + +struct nlm4_holder { + bool_t exclusive; + u_int32_t svid; + netobj oh; + u_int64_t l_offset; + u_int64_t l_len; +}; +typedef struct nlm4_holder nlm4_holder; + +struct nlm4_lock { + char *caller_name; + netobj fh; + netobj oh; + u_int32_t svid; + u_int64_t l_offset; + u_int64_t l_len; +}; +typedef struct nlm4_lock nlm4_lock; + +struct nlm4_share { + char *caller_name; + netobj fh; + netobj oh; + fsh_mode mode; + fsh_access access; +}; +typedef struct nlm4_share nlm4_share; + +struct nlm4_testrply { + nlm4_stats stat; + union { + struct nlm4_holder holder; + } nlm4_testrply_u; +}; +typedef struct nlm4_testrply nlm4_testrply; + +struct nlm4_testres { + netobj cookie; + nlm4_testrply stat; +}; +typedef struct nlm4_testres nlm4_testres; + +struct nlm4_testargs { + netobj cookie; + bool_t exclusive; + struct nlm4_lock alock; +}; +typedef struct nlm4_testargs nlm4_testargs; + +struct nlm4_res { + netobj cookie; + nlm4_stat stat; +}; +typedef struct nlm4_res nlm4_res; + +struct nlm4_lockargs { + netobj cookie; + bool_t block; + bool_t exclusive; + struct nlm4_lock alock; + bool_t reclaim; + int state; +}; +typedef struct nlm4_lockargs nlm4_lockargs; + +struct nlm4_cancargs { + netobj cookie; + bool_t block; + bool_t exclusive; + struct nlm4_lock alock; +}; +typedef struct nlm4_cancargs nlm4_cancargs; + +struct nlm4_unlockargs { + netobj cookie; + struct nlm4_lock alock; +}; +typedef struct nlm4_unlockargs nlm4_unlockargs; + +struct nlm4_shareargs { + netobj cookie; + nlm4_share share; + bool_t reclaim; +}; +typedef struct nlm4_shareargs nlm4_shareargs; + +struct nlm4_shareres { + netobj cookie; + nlm4_stats stat; + int sequence; +}; +typedef struct nlm4_shareres nlm4_shareres; + +#define NLM4_NULL 0 +#define NLM4_TEST 1 +#define NLM4_LOCK 2 +#define NLM4_CANCEL 3 +#define NLM4_UNLOCK 4 +#define NLM4_GRANTED 5 +#define NLM4_TEST_MSG 6 +#define NLM4_LOCK_MSG 7 +#define NLM4_CANCEL_MSG 8 +#define NLM4_UNLOCK_MSG 9 +#define NLM4_GRANTED_MSG 10 +#define NLM4_TEST_RES 11 +#define NLM4_LOCK_RES 12 +#define NLM4_CANCEL_RES 13 +#define NLM4_UNLOCK_RES 14 +#define NLM4_GRANTED_RES 15 +#define NLM4_SM_NOTIFY 16 +#define NLM4_SHARE 20 +#define NLM4_UNSHARE 21 +#define NLM4_NM_LOCK 22 +#define NLM4_FREE_ALL 23 +#define NLM4_PROC_COUNT 24 + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_netobj (XDR *, netobj*); +extern bool_t xdr_fsh_mode (XDR *, fsh_mode*); +extern bool_t xdr_fsh_access (XDR *, fsh_access*); +extern bool_t xdr_nlm4_stats (XDR *, nlm4_stats*); +extern bool_t xdr_nlm4_stat (XDR *, nlm4_stat*); +extern bool_t xdr_nlm4_holder (XDR *, nlm4_holder*); +extern bool_t xdr_nlm4_lock (XDR *, nlm4_lock*); +extern bool_t xdr_nlm4_share (XDR *, nlm4_share*); +extern bool_t xdr_nlm4_testrply (XDR *, nlm4_testrply*); +extern bool_t xdr_nlm4_testres (XDR *, nlm4_testres*); +extern bool_t xdr_nlm4_testargs (XDR *, nlm4_testargs*); +extern bool_t xdr_nlm4_res (XDR *, nlm4_res*); +extern bool_t xdr_nlm4_lockargs (XDR *, nlm4_lockargs*); +extern bool_t xdr_nlm4_cancargs (XDR *, nlm4_cancargs*); +extern bool_t xdr_nlm4_unlockargs (XDR *, nlm4_unlockargs*); +extern bool_t xdr_nlm4_shareargs (XDR *, nlm4_shareargs*); +extern bool_t xdr_nlm4_shareres (XDR *, nlm4_shareres*); + +#else /* K&R C */ +extern bool_t xdr_netobj (); +extern bool_t xdr_fsh_mode (); +extern bool_t xdr_fsh_access (); +extern bool_t xdr_nlm4_stats (); +extern bool_t xdr_nlm4_stat (); +extern bool_t xdr_nlm4_holder (); +extern bool_t xdr_nlm4_lock (); +extern bool_t xdr_nlm4_share (); +extern bool_t xdr_nlm4_testrply (); +extern bool_t xdr_nlm4_testres (); +extern bool_t xdr_nlm4_testargs (); +extern bool_t xdr_nlm4_res (); +extern bool_t xdr_nlm4_lockargs (); +extern bool_t xdr_nlm4_cancargs (); +extern bool_t xdr_nlm4_unlockargs (); +extern bool_t xdr_nlm4_shareargs (); +extern bool_t xdr_nlm4_shareres (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NLM_H_RPCGEN */ diff --git a/rpc/xdr/src/nlm4.x b/rpc/xdr/src/nlm4.x new file mode 100644 index 00000000000..d738b27770d --- /dev/null +++ b/rpc/xdr/src/nlm4.x @@ -0,0 +1,158 @@ +/* + Copyright (c) 2012 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/>. +*/ + +/* .x file defined as according to the RFC */ + +const MAXNETOBJ_SZ = 1024; +const LM_MAXSTRLEN = 1024; +const MAXNAMELEN = 1025; + +typedef opaque netobj<MAXNETOBJ_SZ>; + +#ifdef RPC_HDR +%/* +% * The following enums are actually bit encoded for efficient +% * boolean algebra.... DON'T change them..... +% */ +#endif +enum fsh_mode { + fsm_DN = 0, /* deny none */ + fsm_DR = 1, /* deny read */ + fsm_DW = 2, /* deny write */ + fsm_DRW = 3 /* deny read/write */ +}; + +enum fsh_access { + fsa_NONE = 0, /* for completeness */ + fsa_R = 1, /* read only */ + fsa_W = 2, /* write only */ + fsa_RW = 3 /* read/write */ +}; + +#ifdef RPC_HDR +%/* definitions for NLM version 4 */ +#endif +enum nlm4_stats { + nlm4_granted = 0, + nlm4_denied = 1, + nlm4_denied_nolock = 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 +}; + +struct nlm4_stat { + nlm4_stats stat; +}; + +struct nlm4_holder { + bool exclusive; + u_int32_t svid; + netobj oh; + u_int64_t l_offset; + u_int64_t l_len; +}; + +struct nlm4_lock { + string caller_name<MAXNAMELEN>; + netobj fh; + netobj oh; + u_int32_t svid; + u_int64_t l_offset; + u_int64_t l_len; +}; + +struct nlm4_share { + string caller_name<MAXNAMELEN>; + netobj fh; + netobj oh; + fsh_mode mode; + fsh_access access; +}; + +union nlm4_testrply switch (nlm4_stats stat) { + case nlm_denied: + struct nlm4_holder holder; + default: + void; +}; + +struct nlm4_testres { + netobj cookie; + nlm4_testrply stat; +}; + +struct nlm4_testargs { + netobj cookie; + bool exclusive; + struct nlm4_lock alock; +}; + +struct nlm4_res { + netobj cookie; + nlm4_stat stat; +}; + +struct nlm4_lockargs { + netobj cookie; + bool block; + bool exclusive; + struct nlm4_lock alock; + bool reclaim; /* used for recovering locks */ + int state; /* specify local status monitor state */ +}; + +struct nlm4_cancargs { + netobj cookie; + bool block; + bool exclusive; + struct nlm4_lock alock; +}; + +struct nlm4_unlockargs { + netobj cookie; + struct nlm4_lock alock; +}; + +struct nlm4_shareargs { + netobj cookie; + nlm4_share share; + bool reclaim; +}; + +struct nlm4_shareres { + netobj cookie; + nlm4_stats stat; + int sequence; +}; + +/* + * argument for the procedure called by rpc.statd when a monitored host + * status change. + * XXX assumes LM_MAXSTRLEN == SM_MAXSTRLEN + */ +struct nlm_sm_status { + string mon_name<LM_MAXSTRLEN>; /* name of host */ + int state; /* new state */ + opaque priv[16]; /* private data */ +}; diff --git a/rpc/xdr/src/nlmcbk-xdr.c b/rpc/xdr/src/nlmcbk-xdr.c new file mode 100644 index 00000000000..26446ab1bf4 --- /dev/null +++ b/rpc/xdr/src/nlmcbk-xdr.c @@ -0,0 +1,37 @@ +/* + Copyright (c) 2012 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/>. +*/ + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "nlmcbk-xdr.h" + +bool_t +xdr_nlm_sm_status (XDR *xdrs, nlm_sm_status *objp) +{ + if (!xdr_string (xdrs, &objp->mon_name, LM_MAXSTRLEN)) + return FALSE; + if (!xdr_int (xdrs, &objp->state)) + return FALSE; + if (!xdr_opaque (xdrs, objp->priv, 16)) + return FALSE; + return TRUE; +} diff --git a/rpc/xdr/src/nlmcbk-xdr.h b/rpc/xdr/src/nlmcbk-xdr.h new file mode 100644 index 00000000000..4d6d670ab38 --- /dev/null +++ b/rpc/xdr/src/nlmcbk-xdr.h @@ -0,0 +1,74 @@ +/* + Copyright (c) 2012 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/>. +*/ + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _NLMCBK_H_RPCGEN +#define _NLMCBK_H_RPCGEN + +#include <rpc/rpc.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#define LM_MAXSTRLEN 1024 + +struct nlm_sm_status { + char *mon_name; + int state; + char priv[16]; +}; +typedef struct nlm_sm_status nlm_sm_status; + +#define NLMCBK_PROGRAM 100021 +#define NLMCBK_V1 1 + +#if defined(__STDC__) || defined(__cplusplus) +#define NLMCBK_SM_NOTIFY 16 +extern void * nlmcbk_sm_notify_0(struct nlm_sm_status *, CLIENT *); +extern void * nlmcbk_sm_notify_0_svc(struct nlm_sm_status *, struct svc_req *); +extern int nlmcbk_program_0_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define NLMCBK_SM_NOTIFY 16 +extern void * nlmcbk_sm_notify_0(); +extern void * nlmcbk_sm_notify_0_svc(); +extern int nlmcbk_program_0_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_nlm_sm_status (XDR *, nlm_sm_status*); + +#else /* K&R C */ +extern bool_t xdr_nlm_sm_status (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NLMCBK_H_RPCGEN */ diff --git a/rpc/xdr/src/nlmcbk.x b/rpc/xdr/src/nlmcbk.x new file mode 100644 index 00000000000..49901047eb3 --- /dev/null +++ b/rpc/xdr/src/nlmcbk.x @@ -0,0 +1,33 @@ +/* + Copyright (c) 2012 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/>. +*/ + +const LM_MAXSTRLEN = 1024; + +struct nlm_sm_status { + string mon_name<LM_MAXSTRLEN>; /* name of host */ + int state; /* new state */ + opaque priv[16]; /* private data */ +}; + +program NLMCBK_PROGRAM { + version NLMCBK_V0 { + void NLMCBK_SM_NOTIFY(struct nlm_sm_status) = 1; + } = 0; +} = 1238477; + diff --git a/rpc/xdr/src/nsm-xdr.c b/rpc/xdr/src/nsm-xdr.c new file mode 100644 index 00000000000..8c41b4365a2 --- /dev/null +++ b/rpc/xdr/src/nsm-xdr.c @@ -0,0 +1,105 @@ +/* + Copyright (c) 2012 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/>. +*/ + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "nsm-xdr.h" + +bool_t +xdr_sm_name (XDR *xdrs, sm_name *objp) +{ + if (!xdr_string (xdrs, &objp->mon_name, SM_MAXSTRLEN)) + return FALSE; + return TRUE; +} + +bool_t +xdr_res (XDR *xdrs, res *objp) +{ + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_sm_stat_res (XDR *xdrs, sm_stat_res *objp) +{ + if (!xdr_res (xdrs, &objp->res_stat)) + return FALSE; + if (!xdr_int (xdrs, &objp->state)) + return FALSE; + return TRUE; +} + +bool_t +xdr_sm_stat (XDR *xdrs, sm_stat *objp) +{ + if (!xdr_int (xdrs, &objp->state)) + return FALSE; + return TRUE; +} + +bool_t +xdr_my_id (XDR *xdrs, my_id *objp) +{ + if (!xdr_string (xdrs, &objp->my_name, SM_MAXSTRLEN)) + return FALSE; + if (!xdr_int (xdrs, &objp->my_prog)) + return FALSE; + if (!xdr_int (xdrs, &objp->my_vers)) + return FALSE; + if (!xdr_int (xdrs, &objp->my_proc)) + return FALSE; + return TRUE; +} + +bool_t +xdr_mon_id (XDR *xdrs, mon_id *objp) +{ + if (!xdr_string (xdrs, &objp->mon_name, SM_MAXSTRLEN)) + return FALSE; + if (!xdr_my_id (xdrs, &objp->my_id)) + return FALSE; + return TRUE; +} + +bool_t +xdr_mon (XDR *xdrs, mon *objp) +{ + if (!xdr_mon_id (xdrs, &objp->mon_id)) + return FALSE; + if (!xdr_opaque (xdrs, objp->priv, 16)) + return FALSE; + return TRUE; +} + +bool_t +xdr_nsm_callback_status (XDR *xdrs, nsm_callback_status *objp) +{ + if (!xdr_string (xdrs, &objp->mon_name, SM_MAXSTRLEN)) + return FALSE; + if (!xdr_int (xdrs, &objp->state)) + return FALSE; + if (!xdr_opaque (xdrs, objp->priv, 16)) + return FALSE; + return TRUE; +} diff --git a/rpc/xdr/src/nsm-xdr.h b/rpc/xdr/src/nsm-xdr.h new file mode 100644 index 00000000000..9de642c1572 --- /dev/null +++ b/rpc/xdr/src/nsm-xdr.h @@ -0,0 +1,95 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _NSM_H_RPCGEN +#define _NSM_H_RPCGEN + +#include <rpc/rpc.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#define SM_MAXSTRLEN 1024 + +struct sm_name { + char *mon_name; +}; +typedef struct sm_name sm_name; + +enum res { + STAT_SUCC = 0, + STAT_FAIL = 1, +}; +typedef enum res res; + +struct sm_stat_res { + res res_stat; + int state; +}; +typedef struct sm_stat_res sm_stat_res; + +struct sm_stat { + int state; +}; +typedef struct sm_stat sm_stat; + +struct my_id { + char *my_name; + int my_prog; + int my_vers; + int my_proc; +}; +typedef struct my_id my_id; + +struct mon_id { + char *mon_name; + struct my_id my_id; +}; +typedef struct mon_id mon_id; + +struct mon { + struct mon_id mon_id; + char priv[16]; +}; +typedef struct mon mon; + +struct nsm_callback_status { + char *mon_name; + int state; + char priv[16]; +}; +typedef struct nsm_callback_status nsm_callback_status; + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_sm_name (XDR *, sm_name*); +extern bool_t xdr_res (XDR *, res*); +extern bool_t xdr_sm_stat_res (XDR *, sm_stat_res*); +extern bool_t xdr_sm_stat (XDR *, sm_stat*); +extern bool_t xdr_my_id (XDR *, my_id*); +extern bool_t xdr_mon_id (XDR *, mon_id*); +extern bool_t xdr_mon (XDR *, mon*); +extern bool_t xdr_nsm_callback_status (XDR *, nsm_callback_status*); + +#else /* K&R C */ +extern bool_t xdr_sm_name (); +extern bool_t xdr_res (); +extern bool_t xdr_sm_stat_res (); +extern bool_t xdr_sm_stat (); +extern bool_t xdr_my_id (); +extern bool_t xdr_mon_id (); +extern bool_t xdr_mon (); +extern bool_t xdr_nsm_callback_status (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NSM_H_RPCGEN */ diff --git a/rpc/xdr/src/nsm.x b/rpc/xdr/src/nsm.x new file mode 100644 index 00000000000..8f97b1aaa1f --- /dev/null +++ b/rpc/xdr/src/nsm.x @@ -0,0 +1,47 @@ +/* + * This defines the maximum length of the string + * identifying the caller. + */ +const SM_MAXSTRLEN = 1024; + +struct sm_name { + string mon_name<SM_MAXSTRLEN>; +}; + +enum res { + STAT_SUCC = 0, /* NSM agrees to monitor. */ + STAT_FAIL = 1 /* NSM cannot monitor. */ +}; + +struct sm_stat_res { + res res_stat; + int state; +}; + +struct sm_stat { + int state; /* state number of NSM */ +}; + +struct my_id { + string my_name<SM_MAXSTRLEN>; /* hostname */ + int my_prog; /* RPC program number */ + int my_vers; /* program version number */ + int my_proc; /* procedure number */ +}; + +struct mon_id { + string mon_name<SM_MAXSTRLEN>; /* name of the host to be monitored */ + struct my_id my_id; +}; + +struct mon { + struct mon_id mon_id; + opaque priv[16]; /* private information */ +}; + +struct nsm_callback_status { + string mon_name<SM_MAXSTRLEN>; + int state; + opaque priv[16]; /* for private information */ +}; + |