9p: Define and implement TLINK for 9P2000.L
authorVenkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Thu, 3 Jun 2010 22:16:59 +0000 (15:16 -0700)
committerEric Van Hensbergen <ericvh@gmail.com>
Mon, 2 Aug 2010 19:28:25 +0000 (14:28 -0500)
This patch adds a helper function to get the dentry from inode and
uses it in creating a Hardlink

SYNOPSIS

size[4] Tlink tag[2] dfid[4] oldfid[4] newpath[s]

size[4] Rlink tag[2]

DESCRIPTION

Create a link 'newpath' in directory pointed by dfid linking to oldfid path.

[sripathik@in.ibm.com : p9_client_link should not free req structure
if p9_client_rpc has returned an error.]

Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
include/net/9p/9p.h
include/net/9p/client.h
net/9p/client.c

index 7f64d72f6c61d6ddc00c20ac73043d4124f8c43c..5985c0f83db3ebd58c7b3e9bfc59dd4aeeb8406e 100644 (file)
@@ -139,6 +139,8 @@ enum p9_msg_t {
        P9_RSETATTR,
        P9_TREADDIR = 40,
        P9_RREADDIR,
+       P9_TLINK = 70,
+       P9_RLINK,
        P9_TVERSION = 100,
        P9_RVERSION,
        P9_TAUTH = 102,
index afdc385152f601934c45f7f97e236cccae436781..e36f11650e99aa5ebaaf26818e6ff98a0d668d13 100644 (file)
@@ -226,6 +226,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
 int p9_client_open(struct p9_fid *fid, int mode);
 int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
                                                        char *extension);
+int p9_client_link(struct p9_fid *fid, struct p9_fid *oldfid, char *newname);
 int p9_client_clunk(struct p9_fid *fid);
 int p9_client_remove(struct p9_fid *fid);
 int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
index b2f70ec889c225808f483999fb3d17593858ad63..ad1c4489ab4d80e0b24912cca50dc9248b9c6dd4 100644 (file)
@@ -1095,6 +1095,25 @@ error:
 }
 EXPORT_SYMBOL(p9_client_fcreate);
 
+int p9_client_link(struct p9_fid *dfid, struct p9_fid *oldfid, char *newname)
+{
+       struct p9_client *clnt;
+       struct p9_req_t *req;
+
+       P9_DPRINTK(P9_DEBUG_9P, ">>> TLINK dfid %d oldfid %d newname %s\n",
+                       dfid->fid, oldfid->fid, newname);
+       clnt = dfid->clnt;
+       req = p9_client_rpc(clnt, P9_TLINK, "dds", dfid->fid, oldfid->fid,
+                       newname);
+       if (IS_ERR(req))
+               return PTR_ERR(req);
+
+       P9_DPRINTK(P9_DEBUG_9P, "<<< RLINK\n");
+       p9_free_req(clnt, req);
+       return 0;
+}
+EXPORT_SYMBOL(p9_client_link);
+
 int p9_client_clunk(struct p9_fid *fid)
 {
        int err;