aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-05-31 03:52:50 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2010-08-02 15:28:34 -0400
commiteda25e46161527845572131b37706a458d9270ef (patch)
treeb8a68c9185f7f53a135422a41dc68ef2c5f527ee /net
parent0ef63f345c48afe5896c5cffcba57f0457d409b9 (diff)
net/9p: Implement TXATTRCREATE 9p call
TXATTRCREATE: Prepare a fid for setting xattr value on a file system object. size[4] TXATTRCREATE tag[2] fid[4] name[s] attr_size[8] flags[4] size[4] RXATTRCREATE tag[2] txattrcreate gets a fid pointing to xattr. This fid can later be used to set the xattr value. flag value is derived from set Linux setxattr. The manpage says "The flags parameter can be used to refine the semantics of the operation. XATTR_CREATE specifies a pure create, which fails if the named attribute exists already. XATTR_REPLACE specifies a pure replace operation, which fails if the named attribute does not already exist. By default (no flags), the extended attribute will be created if need be, or will simply replace the value if the attribute exists." The actual setxattr operation happens when the fid is clunked. At that point the written byte count and the attr_size specified in TXATTRCREATE should be same otherwise an error will be returned. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/9p/client.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index ec80ee71d453..43396acd714a 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1672,6 +1672,31 @@ error:
1672} 1672}
1673EXPORT_SYMBOL_GPL(p9_client_xattrwalk); 1673EXPORT_SYMBOL_GPL(p9_client_xattrwalk);
1674 1674
1675int p9_client_xattrcreate(struct p9_fid *fid, const char *name,
1676 u64 attr_size, int flags)
1677{
1678 int err;
1679 struct p9_req_t *req;
1680 struct p9_client *clnt;
1681
1682 P9_DPRINTK(P9_DEBUG_9P,
1683 ">>> TXATTRCREATE fid %d name %s size %lld flag %d\n",
1684 fid->fid, name, (long long)attr_size, flags);
1685 err = 0;
1686 clnt = fid->clnt;
1687 req = p9_client_rpc(clnt, P9_TXATTRCREATE, "dsqd",
1688 fid->fid, name, attr_size, flags);
1689 if (IS_ERR(req)) {
1690 err = PTR_ERR(req);
1691 goto error;
1692 }
1693 P9_DPRINTK(P9_DEBUG_9P, "<<< RXATTRCREATE fid %d\n", fid->fid);
1694 p9_free_req(clnt, req);
1695error:
1696 return err;
1697}
1698EXPORT_SYMBOL_GPL(p9_client_xattrcreate);
1699
1675int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset) 1700int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
1676{ 1701{
1677 int err, rsize, total; 1702 int err, rsize, total;