diff options
author | krishna <krishna@gluster.com> | 2011-07-27 18:16:59 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-29 03:37:07 -0700 |
commit | 6c7a89321af50925fb53da378d996881a1907f31 (patch) | |
tree | bfa27e593f6418879a13873c9db6f01676904c7c /xlators/protocol | |
parent | 8b9cb1701f6365f7b4f5ed166f37020781f59467 (diff) |
RPC unify code change
Change-Id: Ibe18a2a63fd023ac57652c4dfc8ac8a69d983b83
BUG: 3112
Signed-off-by: krishna <krishna@gluster.com>
Reviewed-on: http://review.gluster.com/116
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/server/src/server3_1-fops.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 22602d9d7..4f44f3957 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -30,6 +30,7 @@ #include "compat-errno.h" #include "md5.h" +#include "xdr-nfs3.h" /* Callback function section */ @@ -3114,6 +3115,30 @@ server_writev_vec (rpcsvc_request_t *req, struct iovec *payload, return server_writev (req); } +#define SERVER3_1_VECWRITE_START 0 +#define SERVER3_1_VECWRITE_READINGHDR 1 + +int +server_writev_vecsizer (int state, ssize_t *readsize, char *addr) +{ + int nextstate = 0; + gfs3_write_req write_req = {{0,},}; + + switch (state) { + case SERVER3_1_VECWRITE_START: + *readsize = xdr_sizeof ((xdrproc_t) xdr_gfs3_write_req, &write_req); + nextstate = SERVER3_1_VECWRITE_READINGHDR; + break; + case SERVER3_1_VECWRITE_READINGHDR: + *readsize = 0; + nextstate = SERVER3_1_VECWRITE_START; + break; + default: + gf_log ("server3_1", GF_LOG_ERROR, "wrong state: %d", state); + } + return nextstate; +} + int server_release (rpcsvc_request_t *req) @@ -5154,7 +5179,7 @@ rpcsvc_actor_t glusterfs3_1_fop_actors[] = { [GFS3_OP_TRUNCATE] = { "TRUNCATE", GFS3_OP_TRUNCATE, server_truncate, NULL, NULL }, [GFS3_OP_OPEN] = { "OPEN", GFS3_OP_OPEN, server_open, NULL, NULL }, [GFS3_OP_READ] = { "READ", GFS3_OP_READ, server_readv, NULL, NULL }, - [GFS3_OP_WRITE] = { "WRITE", GFS3_OP_WRITE, server_writev, server_writev_vec, NULL }, + [GFS3_OP_WRITE] = { "WRITE", GFS3_OP_WRITE, server_writev, server_writev_vec, server_writev_vecsizer }, [GFS3_OP_STATFS] = { "STATFS", GFS3_OP_STATFS, server_statfs, NULL, NULL }, [GFS3_OP_FLUSH] = { "FLUSH", GFS3_OP_FLUSH, server_flush, NULL, NULL }, [GFS3_OP_FSYNC] = { "FSYNC", GFS3_OP_FSYNC, server_fsync, NULL, NULL }, |