aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/9p/vfs_inode.c7
-rw-r--r--include/net/9p/9p.h13
-rw-r--r--include/net/9p/client.h1
-rw-r--r--net/9p/client.c28
4 files changed, 49 insertions, 0 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 13a8ed6088b8..de9a39590b70 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -794,6 +794,13 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
794 goto clunk_olddir; 794 goto clunk_olddir;
795 } 795 }
796 796
797 if (v9fs_proto_dotl(v9ses)) {
798 retval = p9_client_rename(oldfid, newdirfid,
799 (char *) new_dentry->d_name.name);
800 if (retval != -ENOSYS)
801 goto clunk_newdir;
802 }
803
797 /* 9P can only handle file rename in the same directory */ 804 /* 9P can only handle file rename in the same directory */
798 if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) { 805 if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) {
799 P9_DPRINTK(P9_DEBUG_ERROR, 806 P9_DPRINTK(P9_DEBUG_ERROR,
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 59300dc22dd0..156c26bb8bd7 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -88,6 +88,8 @@ do { \
88 * enum p9_msg_t - 9P message types 88 * enum p9_msg_t - 9P message types
89 * @P9_TSTATFS: file system status request 89 * @P9_TSTATFS: file system status request
90 * @P9_RSTATFS: file system status response 90 * @P9_RSTATFS: file system status response
91 * @P9_TRENAME: rename request
92 * @P9_RRENAME: rename response
91 * @P9_TVERSION: version handshake request 93 * @P9_TVERSION: version handshake request
92 * @P9_RVERSION: version handshake response 94 * @P9_RVERSION: version handshake response
93 * @P9_TAUTH: request to establish authentication channel 95 * @P9_TAUTH: request to establish authentication channel
@@ -129,6 +131,8 @@ do { \
129enum p9_msg_t { 131enum p9_msg_t {
130 P9_TSTATFS = 8, 132 P9_TSTATFS = 8,
131 P9_RSTATFS, 133 P9_RSTATFS,
134 P9_TRENAME = 20,
135 P9_RRENAME,
132 P9_TVERSION = 100, 136 P9_TVERSION = 100,
133 P9_RVERSION, 137 P9_RVERSION,
134 P9_TAUTH = 102, 138 P9_TAUTH = 102,
@@ -370,6 +374,15 @@ struct p9_rstatfs {
370 u32 namelen; 374 u32 namelen;
371}; 375};
372 376
377struct p9_trename {
378 u32 fid;
379 u32 newdirfid;
380 struct p9_str name;
381};
382
383struct p9_rrename {
384};
385
373struct p9_tversion { 386struct p9_tversion {
374 u32 msize; 387 u32 msize;
375 struct p9_str version; 388 struct p9_str version;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index f83c0d99e592..7dd3ed85c782 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -196,6 +196,7 @@ struct p9_fid {
196}; 196};
197 197
198int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); 198int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
199int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name);
199int p9_client_version(struct p9_client *); 200int p9_client_version(struct p9_client *);
200struct p9_client *p9_client_create(const char *dev_name, char *options); 201struct p9_client *p9_client_create(const char *dev_name, char *options);
201void p9_client_destroy(struct p9_client *clnt); 202void p9_client_destroy(struct p9_client *clnt);
diff --git a/net/9p/client.c b/net/9p/client.c
index 430a1c4a7c6f..37c8da07a80b 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1404,3 +1404,31 @@ error:
1404 return err; 1404 return err;
1405} 1405}
1406EXPORT_SYMBOL(p9_client_statfs); 1406EXPORT_SYMBOL(p9_client_statfs);
1407
1408int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name)
1409{
1410 int err;
1411 struct p9_req_t *req;
1412 struct p9_client *clnt;
1413
1414 err = 0;
1415 clnt = fid->clnt;
1416
1417 P9_DPRINTK(P9_DEBUG_9P, ">>> TRENAME fid %d newdirfid %d name %s\n",
1418 fid->fid, newdirfid->fid, name);
1419
1420 req = p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid,
1421 newdirfid->fid, name);
1422 if (IS_ERR(req)) {
1423 err = PTR_ERR(req);
1424 goto error;
1425 }
1426
1427 P9_DPRINTK(P9_DEBUG_9P, "<<< RRENAME fid %d\n", fid->fid);
1428
1429 p9_free_req(clnt, req);
1430error:
1431 return err;
1432}
1433EXPORT_SYMBOL(p9_client_rename);
1434