diff options
author | Amar Tumballi <amar@gluster.com> | 2011-08-29 17:53:24 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-09-07 10:48:52 -0700 |
commit | f0f3b040dfa062021d3a193e5a19c380eb5e908d (patch) | |
tree | 5e78d2dc05a2aa143b68b0980e21f09511c9120b /xlators/mgmt/glusterd/src/glusterd-pmap.c | |
parent | f78c8253d7fb75762effcf64683cbce10783a55b (diff) |
modify to the way we used XDR definitions files (.x files)
Earlier:
step 1: copy the existing <xdr>.x files to /tmp
step 2: generate '.[ch]' files using 'rpcgen <xdr>.x'
step 3: check diff with the to the existing files, add only your part
of changes back to the original file. (ignore other changes).
step 4: there is another file to write wrapper functions to convert
structures to/from XDR buffers, update it with your new structure.
step 5: use these wrapper functions in the newly written procedures.
step 6: commit :-|
Now:
step 1: update (mostly adding only) the <xdr>.x file
step 2: run '<path-to-src>/extras/generate-xdr-files.sh <xdr>.x' command
step 3: implement rpc procedure to handle the request/response.
step 4: commit :-)
Change-Id: I219f9159fc980438c86e847c6b030be96e595ea2
BUG: 3488
Reviewed-on: http://review.gluster.com/341
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-pmap.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-pmap.c | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index 2658cf40a22..871539a50c6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -30,7 +30,8 @@ #include "glusterd.h" #include "glusterd-utils.h" -#include "portmap.h" +#include "portmap-xdr.h" +#include "xdr-generic.h" #include "protocol-common.h" #include "rpcsvc.h" @@ -290,27 +291,6 @@ out: return 0; } - -typedef ssize_t (*gfs_serialize_t) (struct iovec outmsg, void *data); - - -static int -xdr_to_glusterfs_req (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc) -{ - int ret = -1; - - if (!req) - return -1; - - ret = sfunc (req->msg[0], arg); - - if (ret > 0) - ret = 0; - - return ret; -} - - int gluster_pmap_portbybrick (rpcsvc_request_t *req) { @@ -319,7 +299,8 @@ gluster_pmap_portbybrick (rpcsvc_request_t *req) char *brick = NULL; int port = 0; - if (xdr_to_glusterfs_req (req, &args, xdr_to_pmap_port_by_brick_req)) { + if (!xdr_to_generic (req->msg[0], &args, + (xdrproc_t)xdr_pmap_port_by_brick_req)) { req->rpc_err = GARBAGE_ARGS; goto fail; } @@ -335,7 +316,6 @@ gluster_pmap_portbybrick (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_port_by_brick_rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -350,7 +330,8 @@ gluster_pmap_brickbyport (rpcsvc_request_t *req) pmap_brick_by_port_req args = {0,}; pmap_brick_by_port_rsp rsp = {0,}; - if (xdr_to_glusterfs_req (req, &args, xdr_to_pmap_brick_by_port_req)) { + if (!xdr_to_generic (req->msg[0], &args, + (xdrproc_t)xdr_pmap_brick_by_port_req)) { req->rpc_err = GARBAGE_ARGS; goto fail; } @@ -363,7 +344,6 @@ gluster_pmap_brickbyport (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_brick_by_port_rsp, (xdrproc_t)xdr_pmap_brick_by_port_rsp); return 0; @@ -385,7 +365,8 @@ gluster_pmap_signup (rpcsvc_request_t *req) pmap_signup_rsp rsp = {0,}; - if (xdr_to_glusterfs_req (req, &args, xdr_to_pmap_signup_req)) { + if (!xdr_to_generic (req->msg[0], &args, + (xdrproc_t)xdr_pmap_signup_req)) { req->rpc_err = GARBAGE_ARGS; goto fail; } @@ -395,7 +376,6 @@ gluster_pmap_signup (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signup_rsp, (xdrproc_t)xdr_pmap_signup_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -411,7 +391,8 @@ gluster_pmap_signin (rpcsvc_request_t *req) glusterd_brickinfo_t *brickinfo = NULL; int ret = -1; - if (xdr_to_glusterfs_req (req, &args, xdr_to_pmap_signin_req)) { + if (!xdr_to_generic (req->msg[0], &args, + (xdrproc_t)xdr_pmap_signin_req)) { req->rpc_err = GARBAGE_ARGS; goto fail; } @@ -423,7 +404,6 @@ gluster_pmap_signin (rpcsvc_request_t *req) &brickinfo); fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signin_rsp, (xdrproc_t)xdr_pmap_signin_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -444,7 +424,8 @@ gluster_pmap_signout (rpcsvc_request_t *req) int ret = -1; glusterd_brickinfo_t *brickinfo = NULL; - if (xdr_to_glusterfs_req (req, &args, xdr_to_pmap_signout_req)) { + if (!xdr_to_generic (req->msg[0], &args, + (xdrproc_t)xdr_pmap_signout_req)) { //failed to decode msg; req->rpc_err = GARBAGE_ARGS; goto fail; @@ -457,7 +438,6 @@ gluster_pmap_signout (rpcsvc_request_t *req) &brickinfo); fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signout_rsp, (xdrproc_t)xdr_pmap_signout_rsp); if (args.brick) free (args.brick);//malloced by xdr |