aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-06-28 06:11:16 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2011-07-23 10:32:51 -0400
commit9e8fb38e7d7a00e5f63bbb331f0ea4c02286d5e6 (patch)
tree239ba68a93cb3908b1c1269415632ab18c13f47d /net
parented80fcfac2565fa866d93ba14f0e75de17a8223e (diff)
fs/9p: add 9P2000.L renameat operation
renameat - change name of file or directory size[4] Trenameat tag[2] olddirfid[4] oldname[s] newdirfid[4] newname[s] size[4] Rrenameat tag[2] older Trename have the below request format size[4] Trename tag[2] fid[4] newdirfid[4] name[s] The rename message is used to change the name of a file, possibly moving it to a new directory. The rename opreation is actually a directory opertation and should ideally have olddirfid, if not we cannot represent the fid on server with anything other than name. We will have to derive the old directory name from fid in the Trename request. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/9p/client.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 431eaef697c7..c4b77f383582 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1666,7 +1666,8 @@ error:
1666} 1666}
1667EXPORT_SYMBOL(p9_client_statfs); 1667EXPORT_SYMBOL(p9_client_statfs);
1668 1668
1669int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name) 1669int p9_client_rename(struct p9_fid *fid,
1670 struct p9_fid *newdirfid, const char *name)
1670{ 1671{
1671 int err; 1672 int err;
1672 struct p9_req_t *req; 1673 struct p9_req_t *req;
@@ -1693,6 +1694,36 @@ error:
1693} 1694}
1694EXPORT_SYMBOL(p9_client_rename); 1695EXPORT_SYMBOL(p9_client_rename);
1695 1696
1697int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name,
1698 struct p9_fid *newdirfid, const char *new_name)
1699{
1700 int err;
1701 struct p9_req_t *req;
1702 struct p9_client *clnt;
1703
1704 err = 0;
1705 clnt = olddirfid->clnt;
1706
1707 P9_DPRINTK(P9_DEBUG_9P, ">>> TRENAMEAT olddirfid %d old name %s"
1708 " newdirfid %d new name %s\n", olddirfid->fid, old_name,
1709 newdirfid->fid, new_name);
1710
1711 req = p9_client_rpc(clnt, P9_TRENAMEAT, "dsds", olddirfid->fid,
1712 old_name, newdirfid->fid, new_name);
1713 if (IS_ERR(req)) {
1714 err = PTR_ERR(req);
1715 goto error;
1716 }
1717
1718 P9_DPRINTK(P9_DEBUG_9P, "<<< RRENAMEAT newdirfid %d new name %s\n",
1719 newdirfid->fid, new_name);
1720
1721 p9_free_req(clnt, req);
1722error:
1723 return err;
1724}
1725EXPORT_SYMBOL(p9_client_renameat);
1726
1696/* 1727/*
1697 * An xattrwalk without @attr_name gives the fid for the lisxattr namespace 1728 * An xattrwalk without @attr_name gives the fid for the lisxattr namespace
1698 */ 1729 */