diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 16:25:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 16:25:24 -0500 |
commit | b13d3c6e8ab6ac53e8c1858a9c837cb6ba3bbef0 (patch) | |
tree | 4c0b6cba4975b0d7871096e0a99406d450b0272f /fs | |
parent | e213e26ab3988c516c06eba4dcd030ac052f6dc9 (diff) | |
parent | 5717144a01d701614cfdb15f09ed562d720cf3db (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
fs/9p: Add hardlink support to .u extension
9P2010.L handshake: .L protocol negotiation
9P2010.L handshake: Remove "dotu" variable
9P2010.L handshake: Add mount option
9P2010.L handshake: Add VFS flags
net/9p: Handle mount errors correctly.
net/9p: Remove MAX_9P_CHAN limit
net/9p: Add multi channel support.
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/fid.c | 2 | ||||
-rw-r--r-- | fs/9p/v9fs.c | 8 | ||||
-rw-r--r-- | fs/9p/v9fs.h | 23 | ||||
-rw-r--r-- | fs/9p/vfs_dir.c | 2 | ||||
-rw-r--r-- | fs/9p/vfs_file.c | 4 | ||||
-rw-r--r-- | fs/9p/vfs_inode.c | 48 |
6 files changed, 56 insertions, 31 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 14d944204571..08b2eb157048 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -151,7 +151,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
151 | if (access == V9FS_ACCESS_SINGLE) | 151 | if (access == V9FS_ACCESS_SINGLE) |
152 | return ERR_PTR(-EPERM); | 152 | return ERR_PTR(-EPERM); |
153 | 153 | ||
154 | if (v9fs_extended(v9ses)) | 154 | if (v9fs_proto_dotu(v9ses)) |
155 | uname = NULL; | 155 | uname = NULL; |
156 | else | 156 | else |
157 | uname = v9ses->uname; | 157 | uname = v9ses->uname; |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 7d6c2139891d..6c7f6a251115 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -241,7 +241,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
241 | list_add(&v9ses->slist, &v9fs_sessionlist); | 241 | list_add(&v9ses->slist, &v9fs_sessionlist); |
242 | spin_unlock(&v9fs_sessionlist_lock); | 242 | spin_unlock(&v9fs_sessionlist_lock); |
243 | 243 | ||
244 | v9ses->flags = V9FS_EXTENDED | V9FS_ACCESS_USER; | 244 | v9ses->flags = V9FS_PROTO_2000U | V9FS_ACCESS_USER; |
245 | strcpy(v9ses->uname, V9FS_DEFUSER); | 245 | strcpy(v9ses->uname, V9FS_DEFUSER); |
246 | strcpy(v9ses->aname, V9FS_DEFANAME); | 246 | strcpy(v9ses->aname, V9FS_DEFANAME); |
247 | v9ses->uid = ~0; | 247 | v9ses->uid = ~0; |
@@ -262,13 +262,13 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
262 | goto error; | 262 | goto error; |
263 | } | 263 | } |
264 | 264 | ||
265 | if (!v9ses->clnt->dotu) | 265 | if (!p9_is_proto_dotu(v9ses->clnt)) |
266 | v9ses->flags &= ~V9FS_EXTENDED; | 266 | v9ses->flags &= ~V9FS_PROTO_2000U; |
267 | 267 | ||
268 | v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ; | 268 | v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ; |
269 | 269 | ||
270 | /* for legacy mode, fall back to V9FS_ACCESS_ANY */ | 270 | /* for legacy mode, fall back to V9FS_ACCESS_ANY */ |
271 | if (!v9fs_extended(v9ses) && | 271 | if (!v9fs_proto_dotu(v9ses) && |
272 | ((v9ses->flags&V9FS_ACCESS_MASK) == V9FS_ACCESS_USER)) { | 272 | ((v9ses->flags&V9FS_ACCESS_MASK) == V9FS_ACCESS_USER)) { |
273 | 273 | ||
274 | v9ses->flags &= ~V9FS_ACCESS_MASK; | 274 | v9ses->flags &= ~V9FS_ACCESS_MASK; |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 019f4ccb70c1..79000bf62491 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -23,7 +23,8 @@ | |||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * enum p9_session_flags - option flags for each 9P session | 25 | * enum p9_session_flags - option flags for each 9P session |
26 | * @V9FS_EXTENDED: whether or not to use 9P2000.u extensions | 26 | * @V9FS_PROTO_2000U: whether or not to use 9P2000.u extensions |
27 | * @V9FS_PROTO_2010L: whether or not to use 9P2010.l extensions | ||
27 | * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy | 28 | * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy |
28 | * @V9FS_ACCESS_USER: a new attach will be issued for every user (default) | 29 | * @V9FS_ACCESS_USER: a new attach will be issued for every user (default) |
29 | * @V9FS_ACCESS_ANY: use a single attach for all users | 30 | * @V9FS_ACCESS_ANY: use a single attach for all users |
@@ -32,11 +33,12 @@ | |||
32 | * Session flags reflect options selected by users at mount time | 33 | * Session flags reflect options selected by users at mount time |
33 | */ | 34 | */ |
34 | enum p9_session_flags { | 35 | enum p9_session_flags { |
35 | V9FS_EXTENDED = 0x01, | 36 | V9FS_PROTO_2000U = 0x01, |
36 | V9FS_ACCESS_SINGLE = 0x02, | 37 | V9FS_PROTO_2010L = 0x02, |
37 | V9FS_ACCESS_USER = 0x04, | 38 | V9FS_ACCESS_SINGLE = 0x04, |
38 | V9FS_ACCESS_ANY = 0x06, | 39 | V9FS_ACCESS_USER = 0x08, |
39 | V9FS_ACCESS_MASK = 0x06, | 40 | V9FS_ACCESS_ANY = 0x0C, |
41 | V9FS_ACCESS_MASK = 0x0C, | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | /* possible values of ->cache */ | 44 | /* possible values of ->cache */ |
@@ -121,7 +123,12 @@ static inline struct v9fs_session_info *v9fs_inode2v9ses(struct inode *inode) | |||
121 | return (inode->i_sb->s_fs_info); | 123 | return (inode->i_sb->s_fs_info); |
122 | } | 124 | } |
123 | 125 | ||
124 | static inline int v9fs_extended(struct v9fs_session_info *v9ses) | 126 | static inline int v9fs_proto_dotu(struct v9fs_session_info *v9ses) |
125 | { | 127 | { |
126 | return v9ses->flags & V9FS_EXTENDED; | 128 | return v9ses->flags & V9FS_PROTO_2000U; |
129 | } | ||
130 | |||
131 | static inline int v9fs_proto_dotl(struct v9fs_session_info *v9ses) | ||
132 | { | ||
133 | return v9ses->flags & V9FS_PROTO_2010L; | ||
127 | } | 134 | } |
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 15cce53bf61e..6580aa449541 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
@@ -135,7 +135,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
135 | while (rdir->head < rdir->tail) { | 135 | while (rdir->head < rdir->tail) { |
136 | err = p9stat_read(rdir->buf + rdir->head, | 136 | err = p9stat_read(rdir->buf + rdir->head, |
137 | buflen - rdir->head, &st, | 137 | buflen - rdir->head, &st, |
138 | fid->clnt->dotu); | 138 | fid->clnt->proto_version); |
139 | if (err) { | 139 | if (err) { |
140 | P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err); | 140 | P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err); |
141 | err = -EIO; | 141 | err = -EIO; |
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 74a0461a9ac0..36122683fae8 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -61,7 +61,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
61 | 61 | ||
62 | P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p \n", inode, file); | 62 | P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p \n", inode, file); |
63 | v9ses = v9fs_inode2v9ses(inode); | 63 | v9ses = v9fs_inode2v9ses(inode); |
64 | omode = v9fs_uflags2omode(file->f_flags, v9fs_extended(v9ses)); | 64 | omode = v9fs_uflags2omode(file->f_flags, v9fs_proto_dotu(v9ses)); |
65 | fid = file->private_data; | 65 | fid = file->private_data; |
66 | if (!fid) { | 66 | if (!fid) { |
67 | fid = v9fs_fid_clone(file->f_path.dentry); | 67 | fid = v9fs_fid_clone(file->f_path.dentry); |
@@ -77,7 +77,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
77 | i_size_write(inode, 0); | 77 | i_size_write(inode, 0); |
78 | inode->i_blocks = 0; | 78 | inode->i_blocks = 0; |
79 | } | 79 | } |
80 | if ((file->f_flags & O_APPEND) && (!v9fs_extended(v9ses))) | 80 | if ((file->f_flags & O_APPEND) && (!v9fs_proto_dotu(v9ses))) |
81 | generic_file_llseek(file, 0, SEEK_END); | 81 | generic_file_llseek(file, 0, SEEK_END); |
82 | } | 82 | } |
83 | 83 | ||
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index a407fa3388c0..5fe45d692c9f 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -60,7 +60,7 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode) | |||
60 | res = mode & 0777; | 60 | res = mode & 0777; |
61 | if (S_ISDIR(mode)) | 61 | if (S_ISDIR(mode)) |
62 | res |= P9_DMDIR; | 62 | res |= P9_DMDIR; |
63 | if (v9fs_extended(v9ses)) { | 63 | if (v9fs_proto_dotu(v9ses)) { |
64 | if (S_ISLNK(mode)) | 64 | if (S_ISLNK(mode)) |
65 | res |= P9_DMSYMLINK; | 65 | res |= P9_DMSYMLINK; |
66 | if (v9ses->nodev == 0) { | 66 | if (v9ses->nodev == 0) { |
@@ -102,21 +102,21 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode) | |||
102 | 102 | ||
103 | if ((mode & P9_DMDIR) == P9_DMDIR) | 103 | if ((mode & P9_DMDIR) == P9_DMDIR) |
104 | res |= S_IFDIR; | 104 | res |= S_IFDIR; |
105 | else if ((mode & P9_DMSYMLINK) && (v9fs_extended(v9ses))) | 105 | else if ((mode & P9_DMSYMLINK) && (v9fs_proto_dotu(v9ses))) |
106 | res |= S_IFLNK; | 106 | res |= S_IFLNK; |
107 | else if ((mode & P9_DMSOCKET) && (v9fs_extended(v9ses)) | 107 | else if ((mode & P9_DMSOCKET) && (v9fs_proto_dotu(v9ses)) |
108 | && (v9ses->nodev == 0)) | 108 | && (v9ses->nodev == 0)) |
109 | res |= S_IFSOCK; | 109 | res |= S_IFSOCK; |
110 | else if ((mode & P9_DMNAMEDPIPE) && (v9fs_extended(v9ses)) | 110 | else if ((mode & P9_DMNAMEDPIPE) && (v9fs_proto_dotu(v9ses)) |
111 | && (v9ses->nodev == 0)) | 111 | && (v9ses->nodev == 0)) |
112 | res |= S_IFIFO; | 112 | res |= S_IFIFO; |
113 | else if ((mode & P9_DMDEVICE) && (v9fs_extended(v9ses)) | 113 | else if ((mode & P9_DMDEVICE) && (v9fs_proto_dotu(v9ses)) |
114 | && (v9ses->nodev == 0)) | 114 | && (v9ses->nodev == 0)) |
115 | res |= S_IFBLK; | 115 | res |= S_IFBLK; |
116 | else | 116 | else |
117 | res |= S_IFREG; | 117 | res |= S_IFREG; |
118 | 118 | ||
119 | if (v9fs_extended(v9ses)) { | 119 | if (v9fs_proto_dotu(v9ses)) { |
120 | if ((mode & P9_DMSETUID) == P9_DMSETUID) | 120 | if ((mode & P9_DMSETUID) == P9_DMSETUID) |
121 | res |= S_ISUID; | 121 | res |= S_ISUID; |
122 | 122 | ||
@@ -265,7 +265,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) | |||
265 | case S_IFBLK: | 265 | case S_IFBLK: |
266 | case S_IFCHR: | 266 | case S_IFCHR: |
267 | case S_IFSOCK: | 267 | case S_IFSOCK: |
268 | if (!v9fs_extended(v9ses)) { | 268 | if (!v9fs_proto_dotu(v9ses)) { |
269 | P9_DPRINTK(P9_DEBUG_ERROR, | 269 | P9_DPRINTK(P9_DEBUG_ERROR, |
270 | "special files without extended mode\n"); | 270 | "special files without extended mode\n"); |
271 | err = -EINVAL; | 271 | err = -EINVAL; |
@@ -278,7 +278,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) | |||
278 | inode->i_fop = &v9fs_file_operations; | 278 | inode->i_fop = &v9fs_file_operations; |
279 | break; | 279 | break; |
280 | case S_IFLNK: | 280 | case S_IFLNK: |
281 | if (!v9fs_extended(v9ses)) { | 281 | if (!v9fs_proto_dotu(v9ses)) { |
282 | P9_DPRINTK(P9_DEBUG_ERROR, | 282 | P9_DPRINTK(P9_DEBUG_ERROR, |
283 | "extended modes used w/o 9P2000.u\n"); | 283 | "extended modes used w/o 9P2000.u\n"); |
284 | err = -EINVAL; | 284 | err = -EINVAL; |
@@ -288,7 +288,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) | |||
288 | break; | 288 | break; |
289 | case S_IFDIR: | 289 | case S_IFDIR: |
290 | inc_nlink(inode); | 290 | inc_nlink(inode); |
291 | if (v9fs_extended(v9ses)) | 291 | if (v9fs_proto_dotu(v9ses)) |
292 | inode->i_op = &v9fs_dir_inode_operations_ext; | 292 | inode->i_op = &v9fs_dir_inode_operations_ext; |
293 | else | 293 | else |
294 | inode->i_op = &v9fs_dir_inode_operations; | 294 | inode->i_op = &v9fs_dir_inode_operations; |
@@ -575,7 +575,8 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
575 | flags = O_RDWR; | 575 | flags = O_RDWR; |
576 | 576 | ||
577 | fid = v9fs_create(v9ses, dir, dentry, NULL, perm, | 577 | fid = v9fs_create(v9ses, dir, dentry, NULL, perm, |
578 | v9fs_uflags2omode(flags, v9fs_extended(v9ses))); | 578 | v9fs_uflags2omode(flags, |
579 | v9fs_proto_dotu(v9ses))); | ||
579 | if (IS_ERR(fid)) { | 580 | if (IS_ERR(fid)) { |
580 | err = PTR_ERR(fid); | 581 | err = PTR_ERR(fid); |
581 | fid = NULL; | 582 | fid = NULL; |
@@ -858,7 +859,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
858 | if (iattr->ia_valid & ATTR_SIZE) | 859 | if (iattr->ia_valid & ATTR_SIZE) |
859 | wstat.length = iattr->ia_size; | 860 | wstat.length = iattr->ia_size; |
860 | 861 | ||
861 | if (v9fs_extended(v9ses)) { | 862 | if (v9fs_proto_dotu(v9ses)) { |
862 | if (iattr->ia_valid & ATTR_UID) | 863 | if (iattr->ia_valid & ATTR_UID) |
863 | wstat.n_uid = iattr->ia_uid; | 864 | wstat.n_uid = iattr->ia_uid; |
864 | 865 | ||
@@ -886,6 +887,8 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, | |||
886 | struct super_block *sb) | 887 | struct super_block *sb) |
887 | { | 888 | { |
888 | char ext[32]; | 889 | char ext[32]; |
890 | char tag_name[14]; | ||
891 | unsigned int i_nlink; | ||
889 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 892 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
890 | 893 | ||
891 | inode->i_nlink = 1; | 894 | inode->i_nlink = 1; |
@@ -897,11 +900,26 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, | |||
897 | inode->i_uid = v9ses->dfltuid; | 900 | inode->i_uid = v9ses->dfltuid; |
898 | inode->i_gid = v9ses->dfltgid; | 901 | inode->i_gid = v9ses->dfltgid; |
899 | 902 | ||
900 | if (v9fs_extended(v9ses)) { | 903 | if (v9fs_proto_dotu(v9ses)) { |
901 | inode->i_uid = stat->n_uid; | 904 | inode->i_uid = stat->n_uid; |
902 | inode->i_gid = stat->n_gid; | 905 | inode->i_gid = stat->n_gid; |
903 | } | 906 | } |
904 | 907 | if ((S_ISREG(inode->i_mode)) || (S_ISDIR(inode->i_mode))) { | |
908 | if (v9fs_proto_dotu(v9ses) && (stat->extension[0] != '\0')) { | ||
909 | /* | ||
910 | * Hadlink support got added later to | ||
911 | * to the .u extension. So there can be | ||
912 | * server out there that doesn't support | ||
913 | * this even with .u extension. So check | ||
914 | * for non NULL stat->extension | ||
915 | */ | ||
916 | strncpy(ext, stat->extension, sizeof(ext)); | ||
917 | /* HARDLINKCOUNT %u */ | ||
918 | sscanf(ext, "%13s %u", tag_name, &i_nlink); | ||
919 | if (!strncmp(tag_name, "HARDLINKCOUNT", 13)) | ||
920 | inode->i_nlink = i_nlink; | ||
921 | } | ||
922 | } | ||
905 | inode->i_mode = p9mode2unixmode(v9ses, stat->mode); | 923 | inode->i_mode = p9mode2unixmode(v9ses, stat->mode); |
906 | if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) { | 924 | if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) { |
907 | char type = 0; | 925 | char type = 0; |
@@ -976,7 +994,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) | |||
976 | if (IS_ERR(fid)) | 994 | if (IS_ERR(fid)) |
977 | return PTR_ERR(fid); | 995 | return PTR_ERR(fid); |
978 | 996 | ||
979 | if (!v9fs_extended(v9ses)) | 997 | if (!v9fs_proto_dotu(v9ses)) |
980 | return -EBADF; | 998 | return -EBADF; |
981 | 999 | ||
982 | st = p9_client_stat(fid); | 1000 | st = p9_client_stat(fid); |
@@ -1066,7 +1084,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1066 | struct p9_fid *fid; | 1084 | struct p9_fid *fid; |
1067 | 1085 | ||
1068 | v9ses = v9fs_inode2v9ses(dir); | 1086 | v9ses = v9fs_inode2v9ses(dir); |
1069 | if (!v9fs_extended(v9ses)) { | 1087 | if (!v9fs_proto_dotu(v9ses)) { |
1070 | P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n"); | 1088 | P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n"); |
1071 | return -EPERM; | 1089 | return -EPERM; |
1072 | } | 1090 | } |