diff options
| -rw-r--r-- | fs/9p/vfs_inode.c | 9 | ||||
| -rw-r--r-- | include/net/9p/9p.h | 2 | ||||
| -rw-r--r-- | include/net/9p/client.h | 5 | ||||
| -rw-r--r-- | net/9p/client.c | 33 |
4 files changed, 44 insertions, 5 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 3bbf705634b2..bce66f56c62c 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
| @@ -904,9 +904,12 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 904 | 904 | ||
| 905 | down_write(&v9ses->rename_sem); | 905 | down_write(&v9ses->rename_sem); |
| 906 | if (v9fs_proto_dotl(v9ses)) { | 906 | if (v9fs_proto_dotl(v9ses)) { |
| 907 | retval = p9_client_rename(oldfid, newdirfid, | 907 | retval = p9_client_renameat(olddirfid, old_dentry->d_name.name, |
| 908 | (char *) new_dentry->d_name.name); | 908 | newdirfid, new_dentry->d_name.name); |
| 909 | if (retval != -ENOSYS) | 909 | if (retval == -EOPNOTSUPP) |
| 910 | retval = p9_client_rename(oldfid, newdirfid, | ||
| 911 | new_dentry->d_name.name); | ||
| 912 | if (retval != -EOPNOTSUPP) | ||
| 910 | goto clunk_newdir; | 913 | goto clunk_newdir; |
| 911 | } | 914 | } |
| 912 | if (old_dentry->d_parent != new_dentry->d_parent) { | 915 | if (old_dentry->d_parent != new_dentry->d_parent) { |
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index 160193e6dddd..61156207c98c 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
| @@ -181,6 +181,8 @@ enum p9_msg_t { | |||
| 181 | P9_RLINK, | 181 | P9_RLINK, |
| 182 | P9_TMKDIR = 72, | 182 | P9_TMKDIR = 72, |
| 183 | P9_RMKDIR, | 183 | P9_RMKDIR, |
| 184 | P9_TRENAMEAT = 74, | ||
| 185 | P9_RRENAMEAT, | ||
| 184 | P9_TVERSION = 100, | 186 | P9_TVERSION = 100, |
| 185 | P9_RVERSION, | 187 | P9_RVERSION, |
| 186 | P9_TAUTH = 102, | 188 | P9_TAUTH = 102, |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index f7a8d036f803..62ceddf9994a 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -211,7 +211,10 @@ struct p9_dirent { | |||
| 211 | }; | 211 | }; |
| 212 | 212 | ||
| 213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); | 213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); |
| 214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); | 214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, |
| 215 | const char *name); | ||
| 216 | int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name, | ||
| 217 | struct p9_fid *newdirfid, const char *new_name); | ||
| 215 | struct p9_client *p9_client_create(const char *dev_name, char *options); | 218 | struct p9_client *p9_client_create(const char *dev_name, char *options); |
| 216 | void p9_client_destroy(struct p9_client *clnt); | 219 | void p9_client_destroy(struct p9_client *clnt); |
| 217 | void p9_client_disconnect(struct p9_client *clnt); | 220 | void p9_client_disconnect(struct p9_client *clnt); |
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 | } |
| 1667 | EXPORT_SYMBOL(p9_client_statfs); | 1667 | EXPORT_SYMBOL(p9_client_statfs); |
| 1668 | 1668 | ||
| 1669 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name) | 1669 | int 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 | } |
| 1694 | EXPORT_SYMBOL(p9_client_rename); | 1695 | EXPORT_SYMBOL(p9_client_rename); |
| 1695 | 1696 | ||
| 1697 | int 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); | ||
| 1722 | error: | ||
| 1723 | return err; | ||
| 1724 | } | ||
| 1725 | EXPORT_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 | */ |
