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/protocol/server/src/server.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/protocol/server/src/server.c')
-rw-r--r-- | xlators/protocol/server/src/server.c | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 32ecc4d8c9b..ec91ba7c21a 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -37,8 +37,8 @@ #include "rpcsvc.h" struct iobuf * -gfs_serialize_reply (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc, - struct iovec *outmsg, xdrproc_t xdrproc) +gfs_serialize_reply (rpcsvc_request_t *req, void *arg, struct iovec *outmsg, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; ssize_t retlen = 0; @@ -65,17 +65,15 @@ gfs_serialize_reply (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc, /* retlen is used to received the error since size_t is unsigned and we * need -1 for error notification during encoding. */ - retlen = -1; - if (sfunc) { - retlen = sfunc (*outmsg, arg); - if (retlen == -1) { - /* Failed to Encode 'GlusterFS' msg in RPC is not exactly - failure of RPC return values.. client should get - notified about this, so there are no missing frames */ - gf_log_callingfn ("", GF_LOG_ERROR, "Failed to encode message"); - req->rpc_err = GARBAGE_ARGS; - retlen = 0; - } + + retlen = xdr_serialize_generic (*outmsg, arg, xdrproc); + if (retlen == -1) { + /* Failed to Encode 'GlusterFS' msg in RPC is not exactly + failure of RPC return values.. client should get + notified about this, so there are no missing frames */ + gf_log_callingfn ("", GF_LOG_ERROR, "Failed to encode message"); + req->rpc_err = GARBAGE_ARGS; + retlen = 0; } } outmsg->iov_len = retlen; @@ -93,8 +91,7 @@ ret: int server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gfs_serialize_t sfunc, - xdrproc_t xdrproc) + struct iobref *iobref, xdrproc_t xdrproc) { struct iobuf *iob = NULL; int ret = -1; @@ -118,7 +115,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, new_iobref = 1; } - iob = gfs_serialize_reply (req, arg, sfunc, &rsp, xdrproc); + iob = gfs_serialize_reply (req, arg, &rsp, xdrproc); if (!iob) { gf_log ("", GF_LOG_ERROR, "Failed to serialize reply"); goto ret; @@ -163,21 +160,6 @@ ret: /* */ int -xdr_to_glusterfs_req (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc) -{ - int ret = -1; - - GF_VALIDATE_OR_GOTO ("server", req, out); - - ret = sfunc (req->msg[0], arg); - - if (ret > 0) - ret = 0; -out: - return ret; -} - -int server_fd (xlator_t *this) { server_conf_t *conf = NULL; |