diff options
author | Poornima G <pgurusid@redhat.com> | 2018-01-16 14:14:39 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-01-31 09:13:58 +0000 |
commit | 542af5714d761e787276111ca8bf7a5c69afb721 (patch) | |
tree | c546c94eac9711ad403bd5c04493f5bb543c800b /xlators/protocol/client/src/client-common.c | |
parent | bb34b07fd2ec5e6c3eed4fe0cdf33479dbf5127b (diff) |
protocol: Implement put fop
Updates #353
Change-Id: I755b9208690be76935d763688fa414521eba3a40
Signed-off-by: Poornima G <pgurusid@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client-common.c')
-rw-r--r-- | xlators/protocol/client/src/client-common.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client-common.c b/xlators/protocol/client/src/client-common.c index 3b4dea1aff1..2a08ce2e0ab 100644 --- a/xlators/protocol/client/src/client-common.c +++ b/xlators/protocol/client/src/client-common.c @@ -3523,6 +3523,41 @@ out: } int +client_pre_put_v2 (xlator_t *this, gfx_put_req *req, loc_t *loc, mode_t mode, + mode_t umask, int32_t flags, size_t size, off_t offset, + dict_t *xattr, dict_t *xdata) +{ + int op_errno = ESTALE; + + if (!(loc && loc->parent)) + goto out; + + if (!gf_uuid_is_null (loc->parent->gfid)) + memcpy (req->pargfid, loc->parent->gfid, 16); + else + memcpy (req->pargfid, loc->pargfid, 16); + + GF_ASSERT_AND_GOTO_WITH_ERROR (this->name, + !gf_uuid_is_null (*((uuid_t *)req->pargfid)), + out, op_errno, EINVAL); + req->bname = (char *)loc->name; + req->mode = mode; + req->umask = umask; + req->flag = gf_flags_from_flags (flags); + req->size = size; + req->offset = offset; + + if (xattr) + dict_to_xdr (xattr, &req->xattr); + + dict_to_xdr (xdata, &req->xdata); + + return 0; +out: + return -op_errno; +} + +int client_post_create_v2 (xlator_t *this, gfx_create_rsp *rsp, struct iatt *stbuf, struct iatt *preparent, struct iatt *postparent, |