aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode.c
diff options
context:
space:
mode:
authorSripathi Kodi <sripathik@in.ibm.com>2010-03-25 08:41:54 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2010-05-21 17:44:33 -0400
commit9b6533c9b331ddbba9a40c972d82222ecffbc359 (patch)
tree62d4f5ece3c2cbefc09197b386cac2cd4a6693ae /fs/9p/vfs_inode.c
parentc56e4acf55c804cbeea0ddb696ef698c73d39826 (diff)
9p: VFS switches for 9p2000.L: VFS switches
Implements VFS switches for 9p2000.L protocol. Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r--fs/9p/vfs_inode.c71
1 files changed, 60 insertions, 11 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index f2434fc9d2c4..13a8ed6088b8 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -44,9 +44,12 @@
44#include "cache.h" 44#include "cache.h"
45 45
46static const struct inode_operations v9fs_dir_inode_operations; 46static const struct inode_operations v9fs_dir_inode_operations;
47static const struct inode_operations v9fs_dir_inode_operations_ext; 47static const struct inode_operations v9fs_dir_inode_operations_dotu;
48static const struct inode_operations v9fs_dir_inode_operations_dotl;
48static const struct inode_operations v9fs_file_inode_operations; 49static const struct inode_operations v9fs_file_inode_operations;
50static const struct inode_operations v9fs_file_inode_operations_dotl;
49static const struct inode_operations v9fs_symlink_inode_operations; 51static const struct inode_operations v9fs_symlink_inode_operations;
52static const struct inode_operations v9fs_symlink_inode_operations_dotl;
50 53
51/** 54/**
52 * unixmode2p9mode - convert unix mode bits to plan 9 55 * unixmode2p9mode - convert unix mode bits to plan 9
@@ -275,25 +278,44 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
275 init_special_inode(inode, inode->i_mode, inode->i_rdev); 278 init_special_inode(inode, inode->i_mode, inode->i_rdev);
276 break; 279 break;
277 case S_IFREG: 280 case S_IFREG:
278 inode->i_op = &v9fs_file_inode_operations; 281 if (v9fs_proto_dotl(v9ses)) {
279 inode->i_fop = &v9fs_file_operations; 282 inode->i_op = &v9fs_file_inode_operations_dotl;
283 inode->i_fop = &v9fs_file_operations_dotl;
284 } else {
285 inode->i_op = &v9fs_file_inode_operations;
286 inode->i_fop = &v9fs_file_operations;
287 }
288
280 break; 289 break;
290
281 case S_IFLNK: 291 case S_IFLNK:
282 if (!v9fs_proto_dotu(v9ses)) { 292 if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) {
283 P9_DPRINTK(P9_DEBUG_ERROR, 293 P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with "
284 "extended modes used w/o 9P2000.u\n"); 294 "legacy protocol.\n");
285 err = -EINVAL; 295 err = -EINVAL;
286 goto error; 296 goto error;
287 } 297 }
288 inode->i_op = &v9fs_symlink_inode_operations; 298
299 if (v9fs_proto_dotl(v9ses))
300 inode->i_op = &v9fs_symlink_inode_operations_dotl;
301 else
302 inode->i_op = &v9fs_symlink_inode_operations;
303
289 break; 304 break;
290 case S_IFDIR: 305 case S_IFDIR:
291 inc_nlink(inode); 306 inc_nlink(inode);
292 if (v9fs_proto_dotu(v9ses)) 307 if (v9fs_proto_dotl(v9ses))
293 inode->i_op = &v9fs_dir_inode_operations_ext; 308 inode->i_op = &v9fs_dir_inode_operations_dotl;
309 else if (v9fs_proto_dotu(v9ses))
310 inode->i_op = &v9fs_dir_inode_operations_dotu;
294 else 311 else
295 inode->i_op = &v9fs_dir_inode_operations; 312 inode->i_op = &v9fs_dir_inode_operations;
296 inode->i_fop = &v9fs_dir_operations; 313
314 if (v9fs_proto_dotl(v9ses))
315 inode->i_fop = &v9fs_dir_operations_dotl;
316 else
317 inode->i_fop = &v9fs_dir_operations;
318
297 break; 319 break;
298 default: 320 default:
299 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", 321 P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
@@ -1208,7 +1230,21 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1208 return retval; 1230 return retval;
1209} 1231}
1210 1232
1211static const struct inode_operations v9fs_dir_inode_operations_ext = { 1233static const struct inode_operations v9fs_dir_inode_operations_dotu = {
1234 .create = v9fs_vfs_create,
1235 .lookup = v9fs_vfs_lookup,
1236 .symlink = v9fs_vfs_symlink,
1237 .link = v9fs_vfs_link,
1238 .unlink = v9fs_vfs_unlink,
1239 .mkdir = v9fs_vfs_mkdir,
1240 .rmdir = v9fs_vfs_rmdir,
1241 .mknod = v9fs_vfs_mknod,
1242 .rename = v9fs_vfs_rename,
1243 .getattr = v9fs_vfs_getattr,
1244 .setattr = v9fs_vfs_setattr,
1245};
1246
1247static const struct inode_operations v9fs_dir_inode_operations_dotl = {
1212 .create = v9fs_vfs_create, 1248 .create = v9fs_vfs_create,
1213 .lookup = v9fs_vfs_lookup, 1249 .lookup = v9fs_vfs_lookup,
1214 .symlink = v9fs_vfs_symlink, 1250 .symlink = v9fs_vfs_symlink,
@@ -1239,6 +1275,11 @@ static const struct inode_operations v9fs_file_inode_operations = {
1239 .setattr = v9fs_vfs_setattr, 1275 .setattr = v9fs_vfs_setattr,
1240}; 1276};
1241 1277
1278static const struct inode_operations v9fs_file_inode_operations_dotl = {
1279 .getattr = v9fs_vfs_getattr,
1280 .setattr = v9fs_vfs_setattr,
1281};
1282
1242static const struct inode_operations v9fs_symlink_inode_operations = { 1283static const struct inode_operations v9fs_symlink_inode_operations = {
1243 .readlink = generic_readlink, 1284 .readlink = generic_readlink,
1244 .follow_link = v9fs_vfs_follow_link, 1285 .follow_link = v9fs_vfs_follow_link,
@@ -1246,3 +1287,11 @@ static const struct inode_operations v9fs_symlink_inode_operations = {
1246 .getattr = v9fs_vfs_getattr, 1287 .getattr = v9fs_vfs_getattr,
1247 .setattr = v9fs_vfs_setattr, 1288 .setattr = v9fs_vfs_setattr,
1248}; 1289};
1290
1291static const struct inode_operations v9fs_symlink_inode_operations_dotl = {
1292 .readlink = generic_readlink,
1293 .follow_link = v9fs_vfs_follow_link,
1294 .put_link = v9fs_vfs_put_link,
1295 .getattr = v9fs_vfs_getattr,
1296 .setattr = v9fs_vfs_setattr,
1297};