aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/9p/v9fs.c6
-rw-r--r--fs/9p/v9fs.h12
-rw-r--r--fs/9p/vfs_inode.c26
3 files changed, 27 insertions, 17 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 08d880fb5b6a..8ac246700b70 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -128,7 +128,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
128 128
129 /* setup defaults */ 129 /* setup defaults */
130 v9ses->maxdata = 8192; 130 v9ses->maxdata = 8192;
131 v9ses->extended = 1; 131 v9ses->flags = V9FS_EXTENDED;
132 v9ses->afid = ~0; 132 v9ses->afid = ~0;
133 v9ses->debug = 0; 133 v9ses->debug = 0;
134 v9ses->cache = 0; 134 v9ses->cache = 0;
@@ -178,7 +178,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
178 match_strcpy(v9ses->remotename, &args[0]); 178 match_strcpy(v9ses->remotename, &args[0]);
179 break; 179 break;
180 case Opt_legacy: 180 case Opt_legacy:
181 v9ses->extended = 0; 181 v9ses->flags &= ~V9FS_EXTENDED;
182 break; 182 break;
183 case Opt_nodevmap: 183 case Opt_nodevmap:
184 v9ses->nodev = 1; 184 v9ses->nodev = 1;
@@ -244,7 +244,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
244 v9ses->maxdata = v9ses->trans->maxsize-P9_IOHDRSZ; 244 v9ses->maxdata = v9ses->trans->maxsize-P9_IOHDRSZ;
245 245
246 v9ses->clnt = p9_client_create(trans, v9ses->maxdata+P9_IOHDRSZ, 246 v9ses->clnt = p9_client_create(trans, v9ses->maxdata+P9_IOHDRSZ,
247 v9ses->extended); 247 v9fs_extended(v9ses));
248 248
249 if (IS_ERR(v9ses->clnt)) { 249 if (IS_ERR(v9ses->clnt)) {
250 retval = PTR_ERR(v9ses->clnt); 250 retval = PTR_ERR(v9ses->clnt);
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 7eb135cf60ca..804b3ef8feab 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -29,7 +29,7 @@
29struct v9fs_session_info { 29struct v9fs_session_info {
30 /* options */ 30 /* options */
31 unsigned int maxdata; 31 unsigned int maxdata;
32 unsigned char extended; /* set to 1 if we are using UNIX extensions */ 32 unsigned char flags; /* session flags */
33 unsigned char nodev; /* set to 1 if no disable device mapping */ 33 unsigned char nodev; /* set to 1 if no disable device mapping */
34 unsigned short debug; /* debug level */ 34 unsigned short debug; /* debug level */
35 unsigned int afid; /* authentication fid */ 35 unsigned int afid; /* authentication fid */
@@ -45,6 +45,11 @@ struct v9fs_session_info {
45 struct dentry *debugfs_dir; 45 struct dentry *debugfs_dir;
46}; 46};
47 47
48/* session flags */
49enum {
50 V9FS_EXTENDED,
51};
52
48/* possible values of ->cache */ 53/* possible values of ->cache */
49/* eventually support loose, tight, time, session, default always none */ 54/* eventually support loose, tight, time, session, default always none */
50enum { 55enum {
@@ -70,3 +75,8 @@ static inline struct v9fs_session_info *v9fs_inode2v9ses(struct inode *inode)
70{ 75{
71 return (inode->i_sb->s_fs_info); 76 return (inode->i_sb->s_fs_info);
72} 77}
78
79static inline int v9fs_extended(struct v9fs_session_info *v9ses)
80{
81 return v9ses->flags & V9FS_EXTENDED;
82}
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index e5c45eed58a9..2270d06ccd56 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -59,7 +59,7 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode)
59 res = mode & 0777; 59 res = mode & 0777;
60 if (S_ISDIR(mode)) 60 if (S_ISDIR(mode))
61 res |= P9_DMDIR; 61 res |= P9_DMDIR;
62 if (v9ses->extended) { 62 if (v9fs_extended(v9ses)) {
63 if (S_ISLNK(mode)) 63 if (S_ISLNK(mode))
64 res |= P9_DMSYMLINK; 64 res |= P9_DMSYMLINK;
65 if (v9ses->nodev == 0) { 65 if (v9ses->nodev == 0) {
@@ -99,21 +99,21 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode)
99 99
100 if ((mode & P9_DMDIR) == P9_DMDIR) 100 if ((mode & P9_DMDIR) == P9_DMDIR)
101 res |= S_IFDIR; 101 res |= S_IFDIR;
102 else if ((mode & P9_DMSYMLINK) && (v9ses->extended)) 102 else if ((mode & P9_DMSYMLINK) && (v9fs_extended(v9ses)))
103 res |= S_IFLNK; 103 res |= S_IFLNK;
104 else if ((mode & P9_DMSOCKET) && (v9ses->extended) 104 else if ((mode & P9_DMSOCKET) && (v9fs_extended(v9ses))
105 && (v9ses->nodev == 0)) 105 && (v9ses->nodev == 0))
106 res |= S_IFSOCK; 106 res |= S_IFSOCK;
107 else if ((mode & P9_DMNAMEDPIPE) && (v9ses->extended) 107 else if ((mode & P9_DMNAMEDPIPE) && (v9fs_extended(v9ses))
108 && (v9ses->nodev == 0)) 108 && (v9ses->nodev == 0))
109 res |= S_IFIFO; 109 res |= S_IFIFO;
110 else if ((mode & P9_DMDEVICE) && (v9ses->extended) 110 else if ((mode & P9_DMDEVICE) && (v9fs_extended(v9ses))
111 && (v9ses->nodev == 0)) 111 && (v9ses->nodev == 0))
112 res |= S_IFBLK; 112 res |= S_IFBLK;
113 else 113 else
114 res |= S_IFREG; 114 res |= S_IFREG;
115 115
116 if (v9ses->extended) { 116 if (v9fs_extended(v9ses)) {
117 if ((mode & P9_DMSETUID) == P9_DMSETUID) 117 if ((mode & P9_DMSETUID) == P9_DMSETUID)
118 res |= S_ISUID; 118 res |= S_ISUID;
119 119
@@ -214,7 +214,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
214 case S_IFBLK: 214 case S_IFBLK:
215 case S_IFCHR: 215 case S_IFCHR:
216 case S_IFSOCK: 216 case S_IFSOCK:
217 if(!v9ses->extended) { 217 if (!v9fs_extended(v9ses)) {
218 P9_DPRINTK(P9_DEBUG_ERROR, 218 P9_DPRINTK(P9_DEBUG_ERROR,
219 "special files without extended mode\n"); 219 "special files without extended mode\n");
220 return ERR_PTR(-EINVAL); 220 return ERR_PTR(-EINVAL);
@@ -227,7 +227,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
227 inode->i_fop = &v9fs_file_operations; 227 inode->i_fop = &v9fs_file_operations;
228 break; 228 break;
229 case S_IFLNK: 229 case S_IFLNK:
230 if(!v9ses->extended) { 230 if (!v9fs_extended(v9ses)) {
231 P9_DPRINTK(P9_DEBUG_ERROR, 231 P9_DPRINTK(P9_DEBUG_ERROR,
232 "extended modes used w/o 9P2000.u\n"); 232 "extended modes used w/o 9P2000.u\n");
233 return ERR_PTR(-EINVAL); 233 return ERR_PTR(-EINVAL);
@@ -236,7 +236,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
236 break; 236 break;
237 case S_IFDIR: 237 case S_IFDIR:
238 inc_nlink(inode); 238 inc_nlink(inode);
239 if(v9ses->extended) 239 if (v9fs_extended(v9ses))
240 inode->i_op = &v9fs_dir_inode_operations_ext; 240 inode->i_op = &v9fs_dir_inode_operations_ext;
241 else 241 else
242 inode->i_op = &v9fs_dir_inode_operations; 242 inode->i_op = &v9fs_dir_inode_operations;
@@ -768,7 +768,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
768 if (iattr->ia_valid & ATTR_SIZE) 768 if (iattr->ia_valid & ATTR_SIZE)
769 wstat.length = iattr->ia_size; 769 wstat.length = iattr->ia_size;
770 770
771 if (v9ses->extended) { 771 if (v9fs_extended(v9ses)) {
772 if (iattr->ia_valid & ATTR_UID) 772 if (iattr->ia_valid & ATTR_UID)
773 wstat.n_uid = iattr->ia_uid; 773 wstat.n_uid = iattr->ia_uid;
774 774
@@ -808,7 +808,7 @@ v9fs_stat2inode(struct p9_stat *stat, struct inode *inode,
808 inode->i_uid = v9ses->uid; 808 inode->i_uid = v9ses->uid;
809 inode->i_gid = v9ses->gid; 809 inode->i_gid = v9ses->gid;
810 810
811 if (v9ses->extended) { 811 if (v9fs_extended(v9ses)) {
812 inode->i_uid = stat->n_uid; 812 inode->i_uid = stat->n_uid;
813 inode->i_gid = stat->n_gid; 813 inode->i_gid = stat->n_gid;
814 } 814 }
@@ -890,7 +890,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
890 if(IS_ERR(fid)) 890 if(IS_ERR(fid))
891 return PTR_ERR(fid); 891 return PTR_ERR(fid);
892 892
893 if (!v9ses->extended) 893 if (!v9fs_extended(v9ses))
894 return -EBADF; 894 return -EBADF;
895 895
896 st = p9_client_stat(fid); 896 st = p9_client_stat(fid);
@@ -1011,7 +1011,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1011 struct p9_fid *fid; 1011 struct p9_fid *fid;
1012 1012
1013 v9ses = v9fs_inode2v9ses(dir); 1013 v9ses = v9fs_inode2v9ses(dir);
1014 if (!v9ses->extended) { 1014 if (!v9fs_extended(v9ses)) {
1015 P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n"); 1015 P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n");
1016 return -EPERM; 1016 return -EPERM;
1017 } 1017 }