diff options
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r-- | fs/9p/vfs_inode.c | 880 |
1 files changed, 14 insertions, 866 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 34bf71b5654..5076eeb9550 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -49,15 +49,8 @@ | |||
49 | 49 | ||
50 | static const struct inode_operations v9fs_dir_inode_operations; | 50 | static const struct inode_operations v9fs_dir_inode_operations; |
51 | static const struct inode_operations v9fs_dir_inode_operations_dotu; | 51 | static const struct inode_operations v9fs_dir_inode_operations_dotu; |
52 | static const struct inode_operations v9fs_dir_inode_operations_dotl; | ||
53 | static const struct inode_operations v9fs_file_inode_operations; | 52 | static const struct inode_operations v9fs_file_inode_operations; |
54 | static const struct inode_operations v9fs_file_inode_operations_dotl; | ||
55 | static const struct inode_operations v9fs_symlink_inode_operations; | 53 | static const struct inode_operations v9fs_symlink_inode_operations; |
56 | static const struct inode_operations v9fs_symlink_inode_operations_dotl; | ||
57 | |||
58 | static int | ||
59 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, | ||
60 | dev_t rdev); | ||
61 | 54 | ||
62 | /** | 55 | /** |
63 | * unixmode2p9mode - convert unix mode bits to plan 9 | 56 | * unixmode2p9mode - convert unix mode bits to plan 9 |
@@ -237,46 +230,18 @@ struct inode *v9fs_alloc_inode(struct super_block *sb) | |||
237 | * | 230 | * |
238 | */ | 231 | */ |
239 | 232 | ||
240 | void v9fs_destroy_inode(struct inode *inode) | 233 | static void v9fs_i_callback(struct rcu_head *head) |
241 | { | 234 | { |
235 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
236 | INIT_LIST_HEAD(&inode->i_dentry); | ||
242 | kmem_cache_free(vcookie_cache, v9fs_inode2cookie(inode)); | 237 | kmem_cache_free(vcookie_cache, v9fs_inode2cookie(inode)); |
243 | } | 238 | } |
244 | #endif | ||
245 | 239 | ||
246 | /** | 240 | void v9fs_destroy_inode(struct inode *inode) |
247 | * v9fs_get_fsgid_for_create - Helper function to get the gid for creating a | ||
248 | * new file system object. This checks the S_ISGID to determine the owning | ||
249 | * group of the new file system object. | ||
250 | */ | ||
251 | |||
252 | static gid_t v9fs_get_fsgid_for_create(struct inode *dir_inode) | ||
253 | { | ||
254 | BUG_ON(dir_inode == NULL); | ||
255 | |||
256 | if (dir_inode->i_mode & S_ISGID) { | ||
257 | /* set_gid bit is set.*/ | ||
258 | return dir_inode->i_gid; | ||
259 | } | ||
260 | return current_fsgid(); | ||
261 | } | ||
262 | |||
263 | /** | ||
264 | * v9fs_dentry_from_dir_inode - helper function to get the dentry from | ||
265 | * dir inode. | ||
266 | * | ||
267 | */ | ||
268 | |||
269 | static struct dentry *v9fs_dentry_from_dir_inode(struct inode *inode) | ||
270 | { | 241 | { |
271 | struct dentry *dentry; | 242 | call_rcu(&inode->i_rcu, v9fs_i_callback); |
272 | |||
273 | spin_lock(&dcache_lock); | ||
274 | /* Directory should have only one entry. */ | ||
275 | BUG_ON(S_ISDIR(inode->i_mode) && !list_is_singular(&inode->i_dentry)); | ||
276 | dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias); | ||
277 | spin_unlock(&dcache_lock); | ||
278 | return dentry; | ||
279 | } | 243 | } |
244 | #endif | ||
280 | 245 | ||
281 | /** | 246 | /** |
282 | * v9fs_get_inode - helper function to setup an inode | 247 | * v9fs_get_inode - helper function to setup an inode |
@@ -447,7 +412,7 @@ void v9fs_evict_inode(struct inode *inode) | |||
447 | #endif | 412 | #endif |
448 | } | 413 | } |
449 | 414 | ||
450 | static struct inode * | 415 | struct inode * |
451 | v9fs_inode(struct v9fs_session_info *v9ses, struct p9_fid *fid, | 416 | v9fs_inode(struct v9fs_session_info *v9ses, struct p9_fid *fid, |
452 | struct super_block *sb) | 417 | struct super_block *sb) |
453 | { | 418 | { |
@@ -482,60 +447,6 @@ error: | |||
482 | return ERR_PTR(err); | 447 | return ERR_PTR(err); |
483 | } | 448 | } |
484 | 449 | ||
485 | static struct inode * | ||
486 | v9fs_inode_dotl(struct v9fs_session_info *v9ses, struct p9_fid *fid, | ||
487 | struct super_block *sb) | ||
488 | { | ||
489 | struct inode *ret = NULL; | ||
490 | int err; | ||
491 | struct p9_stat_dotl *st; | ||
492 | |||
493 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); | ||
494 | if (IS_ERR(st)) | ||
495 | return ERR_CAST(st); | ||
496 | |||
497 | ret = v9fs_get_inode(sb, st->st_mode); | ||
498 | if (IS_ERR(ret)) { | ||
499 | err = PTR_ERR(ret); | ||
500 | goto error; | ||
501 | } | ||
502 | |||
503 | v9fs_stat2inode_dotl(st, ret); | ||
504 | ret->i_ino = v9fs_qid2ino(&st->qid); | ||
505 | #ifdef CONFIG_9P_FSCACHE | ||
506 | v9fs_vcookie_set_qid(ret, &st->qid); | ||
507 | v9fs_cache_inode_get_cookie(ret); | ||
508 | #endif | ||
509 | err = v9fs_get_acl(ret, fid); | ||
510 | if (err) { | ||
511 | iput(ret); | ||
512 | goto error; | ||
513 | } | ||
514 | kfree(st); | ||
515 | return ret; | ||
516 | error: | ||
517 | kfree(st); | ||
518 | return ERR_PTR(err); | ||
519 | } | ||
520 | |||
521 | /** | ||
522 | * v9fs_inode_from_fid - Helper routine to populate an inode by | ||
523 | * issuing a attribute request | ||
524 | * @v9ses: session information | ||
525 | * @fid: fid to issue attribute request for | ||
526 | * @sb: superblock on which to create inode | ||
527 | * | ||
528 | */ | ||
529 | static inline struct inode * | ||
530 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, | ||
531 | struct super_block *sb) | ||
532 | { | ||
533 | if (v9fs_proto_dotl(v9ses)) | ||
534 | return v9fs_inode_dotl(v9ses, fid, sb); | ||
535 | else | ||
536 | return v9fs_inode(v9ses, fid, sb); | ||
537 | } | ||
538 | |||
539 | /** | 450 | /** |
540 | * v9fs_remove - helper function to remove files and directories | 451 | * v9fs_remove - helper function to remove files and directories |
541 | * @dir: directory inode that is being deleted | 452 | * @dir: directory inode that is being deleted |
@@ -626,12 +537,6 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
626 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 537 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
627 | goto error; | 538 | goto error; |
628 | } | 539 | } |
629 | |||
630 | if (v9ses->cache) | ||
631 | dentry->d_op = &v9fs_cached_dentry_operations; | ||
632 | else | ||
633 | dentry->d_op = &v9fs_dentry_operations; | ||
634 | |||
635 | d_instantiate(dentry, inode); | 540 | d_instantiate(dentry, inode); |
636 | err = v9fs_fid_add(dentry, fid); | 541 | err = v9fs_fid_add(dentry, fid); |
637 | if (err < 0) | 542 | if (err < 0) |
@@ -650,144 +555,6 @@ error: | |||
650 | } | 555 | } |
651 | 556 | ||
652 | /** | 557 | /** |
653 | * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol. | ||
654 | * @dir: directory inode that is being created | ||
655 | * @dentry: dentry that is being deleted | ||
656 | * @mode: create permissions | ||
657 | * @nd: path information | ||
658 | * | ||
659 | */ | ||
660 | |||
661 | static int | ||
662 | v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | ||
663 | struct nameidata *nd) | ||
664 | { | ||
665 | int err = 0; | ||
666 | char *name = NULL; | ||
667 | gid_t gid; | ||
668 | int flags; | ||
669 | mode_t mode; | ||
670 | struct v9fs_session_info *v9ses; | ||
671 | struct p9_fid *fid = NULL; | ||
672 | struct p9_fid *dfid, *ofid; | ||
673 | struct file *filp; | ||
674 | struct p9_qid qid; | ||
675 | struct inode *inode; | ||
676 | struct posix_acl *pacl = NULL, *dacl = NULL; | ||
677 | |||
678 | v9ses = v9fs_inode2v9ses(dir); | ||
679 | if (nd && nd->flags & LOOKUP_OPEN) | ||
680 | flags = nd->intent.open.flags - 1; | ||
681 | else { | ||
682 | /* | ||
683 | * create call without LOOKUP_OPEN is due | ||
684 | * to mknod of regular files. So use mknod | ||
685 | * operation. | ||
686 | */ | ||
687 | return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0); | ||
688 | } | ||
689 | |||
690 | name = (char *) dentry->d_name.name; | ||
691 | P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x " | ||
692 | "mode:0x%x\n", name, flags, omode); | ||
693 | |||
694 | dfid = v9fs_fid_lookup(dentry->d_parent); | ||
695 | if (IS_ERR(dfid)) { | ||
696 | err = PTR_ERR(dfid); | ||
697 | P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); | ||
698 | return err; | ||
699 | } | ||
700 | |||
701 | /* clone a fid to use for creation */ | ||
702 | ofid = p9_client_walk(dfid, 0, NULL, 1); | ||
703 | if (IS_ERR(ofid)) { | ||
704 | err = PTR_ERR(ofid); | ||
705 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); | ||
706 | return err; | ||
707 | } | ||
708 | |||
709 | gid = v9fs_get_fsgid_for_create(dir); | ||
710 | |||
711 | mode = omode; | ||
712 | /* Update mode based on ACL value */ | ||
713 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); | ||
714 | if (err) { | ||
715 | P9_DPRINTK(P9_DEBUG_VFS, | ||
716 | "Failed to get acl values in creat %d\n", err); | ||
717 | goto error; | ||
718 | } | ||
719 | err = p9_client_create_dotl(ofid, name, flags, mode, gid, &qid); | ||
720 | if (err < 0) { | ||
721 | P9_DPRINTK(P9_DEBUG_VFS, | ||
722 | "p9_client_open_dotl failed in creat %d\n", | ||
723 | err); | ||
724 | goto error; | ||
725 | } | ||
726 | /* instantiate inode and assign the unopened fid to the dentry */ | ||
727 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE || | ||
728 | (nd && nd->flags & LOOKUP_OPEN)) { | ||
729 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
730 | if (IS_ERR(fid)) { | ||
731 | err = PTR_ERR(fid); | ||
732 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
733 | err); | ||
734 | fid = NULL; | ||
735 | goto error; | ||
736 | } | ||
737 | |||
738 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); | ||
739 | if (IS_ERR(inode)) { | ||
740 | err = PTR_ERR(inode); | ||
741 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", | ||
742 | err); | ||
743 | goto error; | ||
744 | } | ||
745 | dentry->d_op = &v9fs_cached_dentry_operations; | ||
746 | d_instantiate(dentry, inode); | ||
747 | err = v9fs_fid_add(dentry, fid); | ||
748 | if (err < 0) | ||
749 | goto error; | ||
750 | /* The fid would get clunked via a dput */ | ||
751 | fid = NULL; | ||
752 | } else { | ||
753 | /* | ||
754 | * Not in cached mode. No need to populate | ||
755 | * inode with stat. We need to get an inode | ||
756 | * so that we can set the acl with dentry | ||
757 | */ | ||
758 | inode = v9fs_get_inode(dir->i_sb, mode); | ||
759 | if (IS_ERR(inode)) { | ||
760 | err = PTR_ERR(inode); | ||
761 | goto error; | ||
762 | } | ||
763 | dentry->d_op = &v9fs_dentry_operations; | ||
764 | d_instantiate(dentry, inode); | ||
765 | } | ||
766 | /* Now set the ACL based on the default value */ | ||
767 | v9fs_set_create_acl(dentry, dacl, pacl); | ||
768 | |||
769 | /* if we are opening a file, assign the open fid to the file */ | ||
770 | if (nd && nd->flags & LOOKUP_OPEN) { | ||
771 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); | ||
772 | if (IS_ERR(filp)) { | ||
773 | p9_client_clunk(ofid); | ||
774 | return PTR_ERR(filp); | ||
775 | } | ||
776 | filp->private_data = ofid; | ||
777 | } else | ||
778 | p9_client_clunk(ofid); | ||
779 | |||
780 | return 0; | ||
781 | |||
782 | error: | ||
783 | if (ofid) | ||
784 | p9_client_clunk(ofid); | ||
785 | if (fid) | ||
786 | p9_client_clunk(fid); | ||
787 | return err; | ||
788 | } | ||
789 | |||
790 | /** | ||
791 | * v9fs_vfs_create - VFS hook to create files | 558 | * v9fs_vfs_create - VFS hook to create files |
792 | * @dir: directory inode that is being created | 559 | * @dir: directory inode that is being created |
793 | * @dentry: dentry that is being deleted | 560 | * @dentry: dentry that is being deleted |
@@ -877,107 +644,6 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
877 | return err; | 644 | return err; |
878 | } | 645 | } |
879 | 646 | ||
880 | |||
881 | /** | ||
882 | * v9fs_vfs_mkdir_dotl - VFS mkdir hook to create a directory | ||
883 | * @dir: inode that is being unlinked | ||
884 | * @dentry: dentry that is being unlinked | ||
885 | * @mode: mode for new directory | ||
886 | * | ||
887 | */ | ||
888 | |||
889 | static int v9fs_vfs_mkdir_dotl(struct inode *dir, | ||
890 | struct dentry *dentry, int omode) | ||
891 | { | ||
892 | int err; | ||
893 | struct v9fs_session_info *v9ses; | ||
894 | struct p9_fid *fid = NULL, *dfid = NULL; | ||
895 | gid_t gid; | ||
896 | char *name; | ||
897 | mode_t mode; | ||
898 | struct inode *inode; | ||
899 | struct p9_qid qid; | ||
900 | struct dentry *dir_dentry; | ||
901 | struct posix_acl *dacl = NULL, *pacl = NULL; | ||
902 | |||
903 | P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); | ||
904 | err = 0; | ||
905 | v9ses = v9fs_inode2v9ses(dir); | ||
906 | |||
907 | omode |= S_IFDIR; | ||
908 | if (dir->i_mode & S_ISGID) | ||
909 | omode |= S_ISGID; | ||
910 | |||
911 | dir_dentry = v9fs_dentry_from_dir_inode(dir); | ||
912 | dfid = v9fs_fid_lookup(dir_dentry); | ||
913 | if (IS_ERR(dfid)) { | ||
914 | err = PTR_ERR(dfid); | ||
915 | P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); | ||
916 | dfid = NULL; | ||
917 | goto error; | ||
918 | } | ||
919 | |||
920 | gid = v9fs_get_fsgid_for_create(dir); | ||
921 | mode = omode; | ||
922 | /* Update mode based on ACL value */ | ||
923 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); | ||
924 | if (err) { | ||
925 | P9_DPRINTK(P9_DEBUG_VFS, | ||
926 | "Failed to get acl values in mkdir %d\n", err); | ||
927 | goto error; | ||
928 | } | ||
929 | name = (char *) dentry->d_name.name; | ||
930 | err = p9_client_mkdir_dotl(dfid, name, mode, gid, &qid); | ||
931 | if (err < 0) | ||
932 | goto error; | ||
933 | |||
934 | /* instantiate inode and assign the unopened fid to the dentry */ | ||
935 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | ||
936 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
937 | if (IS_ERR(fid)) { | ||
938 | err = PTR_ERR(fid); | ||
939 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
940 | err); | ||
941 | fid = NULL; | ||
942 | goto error; | ||
943 | } | ||
944 | |||
945 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); | ||
946 | if (IS_ERR(inode)) { | ||
947 | err = PTR_ERR(inode); | ||
948 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", | ||
949 | err); | ||
950 | goto error; | ||
951 | } | ||
952 | dentry->d_op = &v9fs_cached_dentry_operations; | ||
953 | d_instantiate(dentry, inode); | ||
954 | err = v9fs_fid_add(dentry, fid); | ||
955 | if (err < 0) | ||
956 | goto error; | ||
957 | fid = NULL; | ||
958 | } else { | ||
959 | /* | ||
960 | * Not in cached mode. No need to populate | ||
961 | * inode with stat. We need to get an inode | ||
962 | * so that we can set the acl with dentry | ||
963 | */ | ||
964 | inode = v9fs_get_inode(dir->i_sb, mode); | ||
965 | if (IS_ERR(inode)) { | ||
966 | err = PTR_ERR(inode); | ||
967 | goto error; | ||
968 | } | ||
969 | dentry->d_op = &v9fs_dentry_operations; | ||
970 | d_instantiate(dentry, inode); | ||
971 | } | ||
972 | /* Now set the ACL based on the default value */ | ||
973 | v9fs_set_create_acl(dentry, dacl, pacl); | ||
974 | |||
975 | error: | ||
976 | if (fid) | ||
977 | p9_client_clunk(fid); | ||
978 | return err; | ||
979 | } | ||
980 | |||
981 | /** | 647 | /** |
982 | * v9fs_vfs_lookup - VFS lookup hook to "walk" to a new inode | 648 | * v9fs_vfs_lookup - VFS lookup hook to "walk" to a new inode |
983 | * @dir: inode that is being walked from | 649 | * @dir: inode that is being walked from |
@@ -986,7 +652,7 @@ error: | |||
986 | * | 652 | * |
987 | */ | 653 | */ |
988 | 654 | ||
989 | static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | 655 | struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, |
990 | struct nameidata *nameidata) | 656 | struct nameidata *nameidata) |
991 | { | 657 | { |
992 | struct super_block *sb; | 658 | struct super_block *sb; |
@@ -1034,9 +700,9 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | |||
1034 | 700 | ||
1035 | inst_out: | 701 | inst_out: |
1036 | if (v9ses->cache) | 702 | if (v9ses->cache) |
1037 | dentry->d_op = &v9fs_cached_dentry_operations; | 703 | d_set_d_op(dentry, &v9fs_cached_dentry_operations); |
1038 | else | 704 | else |
1039 | dentry->d_op = &v9fs_dentry_operations; | 705 | d_set_d_op(dentry, &v9fs_dentry_operations); |
1040 | 706 | ||
1041 | d_add(dentry, inode); | 707 | d_add(dentry, inode); |
1042 | return NULL; | 708 | return NULL; |
@@ -1056,7 +722,7 @@ error: | |||
1056 | * | 722 | * |
1057 | */ | 723 | */ |
1058 | 724 | ||
1059 | static int v9fs_vfs_unlink(struct inode *i, struct dentry *d) | 725 | int v9fs_vfs_unlink(struct inode *i, struct dentry *d) |
1060 | { | 726 | { |
1061 | return v9fs_remove(i, d, 0); | 727 | return v9fs_remove(i, d, 0); |
1062 | } | 728 | } |
@@ -1068,7 +734,7 @@ static int v9fs_vfs_unlink(struct inode *i, struct dentry *d) | |||
1068 | * | 734 | * |
1069 | */ | 735 | */ |
1070 | 736 | ||
1071 | static int v9fs_vfs_rmdir(struct inode *i, struct dentry *d) | 737 | int v9fs_vfs_rmdir(struct inode *i, struct dentry *d) |
1072 | { | 738 | { |
1073 | return v9fs_remove(i, d, 1); | 739 | return v9fs_remove(i, d, 1); |
1074 | } | 740 | } |
@@ -1082,7 +748,7 @@ static int v9fs_vfs_rmdir(struct inode *i, struct dentry *d) | |||
1082 | * | 748 | * |
1083 | */ | 749 | */ |
1084 | 750 | ||
1085 | static int | 751 | int |
1086 | v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 752 | v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
1087 | struct inode *new_dir, struct dentry *new_dentry) | 753 | struct inode *new_dir, struct dentry *new_dentry) |
1088 | { | 754 | { |
@@ -1189,42 +855,6 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1189 | return 0; | 855 | return 0; |
1190 | } | 856 | } |
1191 | 857 | ||
1192 | static int | ||
1193 | v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry, | ||
1194 | struct kstat *stat) | ||
1195 | { | ||
1196 | int err; | ||
1197 | struct v9fs_session_info *v9ses; | ||
1198 | struct p9_fid *fid; | ||
1199 | struct p9_stat_dotl *st; | ||
1200 | |||
1201 | P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry); | ||
1202 | err = -EPERM; | ||
1203 | v9ses = v9fs_inode2v9ses(dentry->d_inode); | ||
1204 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) | ||
1205 | return simple_getattr(mnt, dentry, stat); | ||
1206 | |||
1207 | fid = v9fs_fid_lookup(dentry); | ||
1208 | if (IS_ERR(fid)) | ||
1209 | return PTR_ERR(fid); | ||
1210 | |||
1211 | /* Ask for all the fields in stat structure. Server will return | ||
1212 | * whatever it supports | ||
1213 | */ | ||
1214 | |||
1215 | st = p9_client_getattr_dotl(fid, P9_STATS_ALL); | ||
1216 | if (IS_ERR(st)) | ||
1217 | return PTR_ERR(st); | ||
1218 | |||
1219 | v9fs_stat2inode_dotl(st, dentry->d_inode); | ||
1220 | generic_fillattr(dentry->d_inode, stat); | ||
1221 | /* Change block size to what the server returned */ | ||
1222 | stat->blksize = st->st_blksize; | ||
1223 | |||
1224 | kfree(st); | ||
1225 | return 0; | ||
1226 | } | ||
1227 | |||
1228 | /** | 858 | /** |
1229 | * v9fs_vfs_setattr - set file metadata | 859 | * v9fs_vfs_setattr - set file metadata |
1230 | * @dentry: file whose metadata to set | 860 | * @dentry: file whose metadata to set |
@@ -1284,64 +914,6 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
1284 | } | 914 | } |
1285 | 915 | ||
1286 | /** | 916 | /** |
1287 | * v9fs_vfs_setattr_dotl - set file metadata | ||
1288 | * @dentry: file whose metadata to set | ||
1289 | * @iattr: metadata assignment structure | ||
1290 | * | ||
1291 | */ | ||
1292 | |||
1293 | int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | ||
1294 | { | ||
1295 | int retval; | ||
1296 | struct v9fs_session_info *v9ses; | ||
1297 | struct p9_fid *fid; | ||
1298 | struct p9_iattr_dotl p9attr; | ||
1299 | |||
1300 | P9_DPRINTK(P9_DEBUG_VFS, "\n"); | ||
1301 | |||
1302 | retval = inode_change_ok(dentry->d_inode, iattr); | ||
1303 | if (retval) | ||
1304 | return retval; | ||
1305 | |||
1306 | p9attr.valid = iattr->ia_valid; | ||
1307 | p9attr.mode = iattr->ia_mode; | ||
1308 | p9attr.uid = iattr->ia_uid; | ||
1309 | p9attr.gid = iattr->ia_gid; | ||
1310 | p9attr.size = iattr->ia_size; | ||
1311 | p9attr.atime_sec = iattr->ia_atime.tv_sec; | ||
1312 | p9attr.atime_nsec = iattr->ia_atime.tv_nsec; | ||
1313 | p9attr.mtime_sec = iattr->ia_mtime.tv_sec; | ||
1314 | p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec; | ||
1315 | |||
1316 | retval = -EPERM; | ||
1317 | v9ses = v9fs_inode2v9ses(dentry->d_inode); | ||
1318 | fid = v9fs_fid_lookup(dentry); | ||
1319 | if (IS_ERR(fid)) | ||
1320 | return PTR_ERR(fid); | ||
1321 | |||
1322 | retval = p9_client_setattr(fid, &p9attr); | ||
1323 | if (retval < 0) | ||
1324 | return retval; | ||
1325 | |||
1326 | if ((iattr->ia_valid & ATTR_SIZE) && | ||
1327 | iattr->ia_size != i_size_read(dentry->d_inode)) { | ||
1328 | retval = vmtruncate(dentry->d_inode, iattr->ia_size); | ||
1329 | if (retval) | ||
1330 | return retval; | ||
1331 | } | ||
1332 | |||
1333 | setattr_copy(dentry->d_inode, iattr); | ||
1334 | mark_inode_dirty(dentry->d_inode); | ||
1335 | if (iattr->ia_valid & ATTR_MODE) { | ||
1336 | /* We also want to update ACL when we update mode bits */ | ||
1337 | retval = v9fs_acl_chmod(dentry); | ||
1338 | if (retval < 0) | ||
1339 | return retval; | ||
1340 | } | ||
1341 | return 0; | ||
1342 | } | ||
1343 | |||
1344 | /** | ||
1345 | * v9fs_stat2inode - populate an inode structure with mistat info | 917 | * v9fs_stat2inode - populate an inode structure with mistat info |
1346 | * @stat: Plan 9 metadata (mistat) structure | 918 | * @stat: Plan 9 metadata (mistat) structure |
1347 | * @inode: inode to populate | 919 | * @inode: inode to populate |
@@ -1419,77 +991,6 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, | |||
1419 | } | 991 | } |
1420 | 992 | ||
1421 | /** | 993 | /** |
1422 | * v9fs_stat2inode_dotl - populate an inode structure with stat info | ||
1423 | * @stat: stat structure | ||
1424 | * @inode: inode to populate | ||
1425 | * @sb: superblock of filesystem | ||
1426 | * | ||
1427 | */ | ||
1428 | |||
1429 | void | ||
1430 | v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) | ||
1431 | { | ||
1432 | |||
1433 | if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { | ||
1434 | inode->i_atime.tv_sec = stat->st_atime_sec; | ||
1435 | inode->i_atime.tv_nsec = stat->st_atime_nsec; | ||
1436 | inode->i_mtime.tv_sec = stat->st_mtime_sec; | ||
1437 | inode->i_mtime.tv_nsec = stat->st_mtime_nsec; | ||
1438 | inode->i_ctime.tv_sec = stat->st_ctime_sec; | ||
1439 | inode->i_ctime.tv_nsec = stat->st_ctime_nsec; | ||
1440 | inode->i_uid = stat->st_uid; | ||
1441 | inode->i_gid = stat->st_gid; | ||
1442 | inode->i_nlink = stat->st_nlink; | ||
1443 | inode->i_mode = stat->st_mode; | ||
1444 | inode->i_rdev = new_decode_dev(stat->st_rdev); | ||
1445 | |||
1446 | if ((S_ISBLK(inode->i_mode)) || (S_ISCHR(inode->i_mode))) | ||
1447 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | ||
1448 | |||
1449 | i_size_write(inode, stat->st_size); | ||
1450 | inode->i_blocks = stat->st_blocks; | ||
1451 | } else { | ||
1452 | if (stat->st_result_mask & P9_STATS_ATIME) { | ||
1453 | inode->i_atime.tv_sec = stat->st_atime_sec; | ||
1454 | inode->i_atime.tv_nsec = stat->st_atime_nsec; | ||
1455 | } | ||
1456 | if (stat->st_result_mask & P9_STATS_MTIME) { | ||
1457 | inode->i_mtime.tv_sec = stat->st_mtime_sec; | ||
1458 | inode->i_mtime.tv_nsec = stat->st_mtime_nsec; | ||
1459 | } | ||
1460 | if (stat->st_result_mask & P9_STATS_CTIME) { | ||
1461 | inode->i_ctime.tv_sec = stat->st_ctime_sec; | ||
1462 | inode->i_ctime.tv_nsec = stat->st_ctime_nsec; | ||
1463 | } | ||
1464 | if (stat->st_result_mask & P9_STATS_UID) | ||
1465 | inode->i_uid = stat->st_uid; | ||
1466 | if (stat->st_result_mask & P9_STATS_GID) | ||
1467 | inode->i_gid = stat->st_gid; | ||
1468 | if (stat->st_result_mask & P9_STATS_NLINK) | ||
1469 | inode->i_nlink = stat->st_nlink; | ||
1470 | if (stat->st_result_mask & P9_STATS_MODE) { | ||
1471 | inode->i_mode = stat->st_mode; | ||
1472 | if ((S_ISBLK(inode->i_mode)) || | ||
1473 | (S_ISCHR(inode->i_mode))) | ||
1474 | init_special_inode(inode, inode->i_mode, | ||
1475 | inode->i_rdev); | ||
1476 | } | ||
1477 | if (stat->st_result_mask & P9_STATS_RDEV) | ||
1478 | inode->i_rdev = new_decode_dev(stat->st_rdev); | ||
1479 | if (stat->st_result_mask & P9_STATS_SIZE) | ||
1480 | i_size_write(inode, stat->st_size); | ||
1481 | if (stat->st_result_mask & P9_STATS_BLOCKS) | ||
1482 | inode->i_blocks = stat->st_blocks; | ||
1483 | } | ||
1484 | if (stat->st_result_mask & P9_STATS_GEN) | ||
1485 | inode->i_generation = stat->st_gen; | ||
1486 | |||
1487 | /* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION | ||
1488 | * because the inode structure does not have fields for them. | ||
1489 | */ | ||
1490 | } | ||
1491 | |||
1492 | /** | ||
1493 | * v9fs_qid2ino - convert qid into inode number | 994 | * v9fs_qid2ino - convert qid into inode number |
1494 | * @qid: qid to hash | 995 | * @qid: qid to hash |
1495 | * | 996 | * |
@@ -1595,7 +1096,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
1595 | * | 1096 | * |
1596 | */ | 1097 | */ |
1597 | 1098 | ||
1598 | static void | 1099 | void |
1599 | v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) | 1100 | v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) |
1600 | { | 1101 | { |
1601 | char *s = nd_get_link(nd); | 1102 | char *s = nd_get_link(nd); |
@@ -1639,94 +1140,6 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1639 | } | 1140 | } |
1640 | 1141 | ||
1641 | /** | 1142 | /** |
1642 | * v9fs_vfs_symlink_dotl - helper function to create symlinks | ||
1643 | * @dir: directory inode containing symlink | ||
1644 | * @dentry: dentry for symlink | ||
1645 | * @symname: symlink data | ||
1646 | * | ||
1647 | * See Also: 9P2000.L RFC for more information | ||
1648 | * | ||
1649 | */ | ||
1650 | |||
1651 | static int | ||
1652 | v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, | ||
1653 | const char *symname) | ||
1654 | { | ||
1655 | struct v9fs_session_info *v9ses; | ||
1656 | struct p9_fid *dfid; | ||
1657 | struct p9_fid *fid = NULL; | ||
1658 | struct inode *inode; | ||
1659 | struct p9_qid qid; | ||
1660 | char *name; | ||
1661 | int err; | ||
1662 | gid_t gid; | ||
1663 | |||
1664 | name = (char *) dentry->d_name.name; | ||
1665 | P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n", | ||
1666 | dir->i_ino, name, symname); | ||
1667 | v9ses = v9fs_inode2v9ses(dir); | ||
1668 | |||
1669 | dfid = v9fs_fid_lookup(dentry->d_parent); | ||
1670 | if (IS_ERR(dfid)) { | ||
1671 | err = PTR_ERR(dfid); | ||
1672 | P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); | ||
1673 | return err; | ||
1674 | } | ||
1675 | |||
1676 | gid = v9fs_get_fsgid_for_create(dir); | ||
1677 | |||
1678 | /* Server doesn't alter fid on TSYMLINK. Hence no need to clone it. */ | ||
1679 | err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid); | ||
1680 | |||
1681 | if (err < 0) { | ||
1682 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err); | ||
1683 | goto error; | ||
1684 | } | ||
1685 | |||
1686 | if (v9ses->cache) { | ||
1687 | /* Now walk from the parent so we can get an unopened fid. */ | ||
1688 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
1689 | if (IS_ERR(fid)) { | ||
1690 | err = PTR_ERR(fid); | ||
1691 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
1692 | err); | ||
1693 | fid = NULL; | ||
1694 | goto error; | ||
1695 | } | ||
1696 | |||
1697 | /* instantiate inode and assign the unopened fid to dentry */ | ||
1698 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); | ||
1699 | if (IS_ERR(inode)) { | ||
1700 | err = PTR_ERR(inode); | ||
1701 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", | ||
1702 | err); | ||
1703 | goto error; | ||
1704 | } | ||
1705 | dentry->d_op = &v9fs_cached_dentry_operations; | ||
1706 | d_instantiate(dentry, inode); | ||
1707 | err = v9fs_fid_add(dentry, fid); | ||
1708 | if (err < 0) | ||
1709 | goto error; | ||
1710 | fid = NULL; | ||
1711 | } else { | ||
1712 | /* Not in cached mode. No need to populate inode with stat */ | ||
1713 | inode = v9fs_get_inode(dir->i_sb, S_IFLNK); | ||
1714 | if (IS_ERR(inode)) { | ||
1715 | err = PTR_ERR(inode); | ||
1716 | goto error; | ||
1717 | } | ||
1718 | dentry->d_op = &v9fs_dentry_operations; | ||
1719 | d_instantiate(dentry, inode); | ||
1720 | } | ||
1721 | |||
1722 | error: | ||
1723 | if (fid) | ||
1724 | p9_client_clunk(fid); | ||
1725 | |||
1726 | return err; | ||
1727 | } | ||
1728 | |||
1729 | /** | ||
1730 | * v9fs_vfs_symlink - helper function to create symlinks | 1143 | * v9fs_vfs_symlink - helper function to create symlinks |
1731 | * @dir: directory inode containing symlink | 1144 | * @dir: directory inode containing symlink |
1732 | * @dentry: dentry for symlink | 1145 | * @dentry: dentry for symlink |
@@ -1785,77 +1198,6 @@ clunk_fid: | |||
1785 | } | 1198 | } |
1786 | 1199 | ||
1787 | /** | 1200 | /** |
1788 | * v9fs_vfs_link_dotl - create a hardlink for dotl | ||
1789 | * @old_dentry: dentry for file to link to | ||
1790 | * @dir: inode destination for new link | ||
1791 | * @dentry: dentry for link | ||
1792 | * | ||
1793 | */ | ||
1794 | |||
1795 | static int | ||
1796 | v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, | ||
1797 | struct dentry *dentry) | ||
1798 | { | ||
1799 | int err; | ||
1800 | struct p9_fid *dfid, *oldfid; | ||
1801 | char *name; | ||
1802 | struct v9fs_session_info *v9ses; | ||
1803 | struct dentry *dir_dentry; | ||
1804 | |||
1805 | P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n", | ||
1806 | dir->i_ino, old_dentry->d_name.name, | ||
1807 | dentry->d_name.name); | ||
1808 | |||
1809 | v9ses = v9fs_inode2v9ses(dir); | ||
1810 | dir_dentry = v9fs_dentry_from_dir_inode(dir); | ||
1811 | dfid = v9fs_fid_lookup(dir_dentry); | ||
1812 | if (IS_ERR(dfid)) | ||
1813 | return PTR_ERR(dfid); | ||
1814 | |||
1815 | oldfid = v9fs_fid_lookup(old_dentry); | ||
1816 | if (IS_ERR(oldfid)) | ||
1817 | return PTR_ERR(oldfid); | ||
1818 | |||
1819 | name = (char *) dentry->d_name.name; | ||
1820 | |||
1821 | err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name); | ||
1822 | |||
1823 | if (err < 0) { | ||
1824 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_link failed %d\n", err); | ||
1825 | return err; | ||
1826 | } | ||
1827 | |||
1828 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | ||
1829 | /* Get the latest stat info from server. */ | ||
1830 | struct p9_fid *fid; | ||
1831 | struct p9_stat_dotl *st; | ||
1832 | |||
1833 | fid = v9fs_fid_lookup(old_dentry); | ||
1834 | if (IS_ERR(fid)) | ||
1835 | return PTR_ERR(fid); | ||
1836 | |||
1837 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); | ||
1838 | if (IS_ERR(st)) | ||
1839 | return PTR_ERR(st); | ||
1840 | |||
1841 | v9fs_stat2inode_dotl(st, old_dentry->d_inode); | ||
1842 | |||
1843 | kfree(st); | ||
1844 | } else { | ||
1845 | /* Caching disabled. No need to get upto date stat info. | ||
1846 | * This dentry will be released immediately. So, just hold the | ||
1847 | * inode | ||
1848 | */ | ||
1849 | ihold(old_dentry->d_inode); | ||
1850 | } | ||
1851 | |||
1852 | dentry->d_op = old_dentry->d_op; | ||
1853 | d_instantiate(dentry, old_dentry->d_inode); | ||
1854 | |||
1855 | return err; | ||
1856 | } | ||
1857 | |||
1858 | /** | ||
1859 | * v9fs_vfs_mknod - create a special file | 1201 | * v9fs_vfs_mknod - create a special file |
1860 | * @dir: inode destination for new link | 1202 | * @dir: inode destination for new link |
1861 | * @dentry: dentry for file | 1203 | * @dentry: dentry for file |
@@ -1900,160 +1242,6 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | |||
1900 | return retval; | 1242 | return retval; |
1901 | } | 1243 | } |
1902 | 1244 | ||
1903 | /** | ||
1904 | * v9fs_vfs_mknod_dotl - create a special file | ||
1905 | * @dir: inode destination for new link | ||
1906 | * @dentry: dentry for file | ||
1907 | * @mode: mode for creation | ||
1908 | * @rdev: device associated with special file | ||
1909 | * | ||
1910 | */ | ||
1911 | static int | ||
1912 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, | ||
1913 | dev_t rdev) | ||
1914 | { | ||
1915 | int err; | ||
1916 | char *name; | ||
1917 | mode_t mode; | ||
1918 | struct v9fs_session_info *v9ses; | ||
1919 | struct p9_fid *fid = NULL, *dfid = NULL; | ||
1920 | struct inode *inode; | ||
1921 | gid_t gid; | ||
1922 | struct p9_qid qid; | ||
1923 | struct dentry *dir_dentry; | ||
1924 | struct posix_acl *dacl = NULL, *pacl = NULL; | ||
1925 | |||
1926 | P9_DPRINTK(P9_DEBUG_VFS, | ||
1927 | " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, | ||
1928 | dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev)); | ||
1929 | |||
1930 | if (!new_valid_dev(rdev)) | ||
1931 | return -EINVAL; | ||
1932 | |||
1933 | v9ses = v9fs_inode2v9ses(dir); | ||
1934 | dir_dentry = v9fs_dentry_from_dir_inode(dir); | ||
1935 | dfid = v9fs_fid_lookup(dir_dentry); | ||
1936 | if (IS_ERR(dfid)) { | ||
1937 | err = PTR_ERR(dfid); | ||
1938 | P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err); | ||
1939 | dfid = NULL; | ||
1940 | goto error; | ||
1941 | } | ||
1942 | |||
1943 | gid = v9fs_get_fsgid_for_create(dir); | ||
1944 | mode = omode; | ||
1945 | /* Update mode based on ACL value */ | ||
1946 | err = v9fs_acl_mode(dir, &mode, &dacl, &pacl); | ||
1947 | if (err) { | ||
1948 | P9_DPRINTK(P9_DEBUG_VFS, | ||
1949 | "Failed to get acl values in mknod %d\n", err); | ||
1950 | goto error; | ||
1951 | } | ||
1952 | name = (char *) dentry->d_name.name; | ||
1953 | |||
1954 | err = p9_client_mknod_dotl(dfid, name, mode, rdev, gid, &qid); | ||
1955 | if (err < 0) | ||
1956 | goto error; | ||
1957 | |||
1958 | /* instantiate inode and assign the unopened fid to the dentry */ | ||
1959 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | ||
1960 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
1961 | if (IS_ERR(fid)) { | ||
1962 | err = PTR_ERR(fid); | ||
1963 | P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
1964 | err); | ||
1965 | fid = NULL; | ||
1966 | goto error; | ||
1967 | } | ||
1968 | |||
1969 | inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); | ||
1970 | if (IS_ERR(inode)) { | ||
1971 | err = PTR_ERR(inode); | ||
1972 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", | ||
1973 | err); | ||
1974 | goto error; | ||
1975 | } | ||
1976 | dentry->d_op = &v9fs_cached_dentry_operations; | ||
1977 | d_instantiate(dentry, inode); | ||
1978 | err = v9fs_fid_add(dentry, fid); | ||
1979 | if (err < 0) | ||
1980 | goto error; | ||
1981 | fid = NULL; | ||
1982 | } else { | ||
1983 | /* | ||
1984 | * Not in cached mode. No need to populate inode with stat. | ||
1985 | * socket syscall returns a fd, so we need instantiate | ||
1986 | */ | ||
1987 | inode = v9fs_get_inode(dir->i_sb, mode); | ||
1988 | if (IS_ERR(inode)) { | ||
1989 | err = PTR_ERR(inode); | ||
1990 | goto error; | ||
1991 | } | ||
1992 | dentry->d_op = &v9fs_dentry_operations; | ||
1993 | d_instantiate(dentry, inode); | ||
1994 | } | ||
1995 | /* Now set the ACL based on the default value */ | ||
1996 | v9fs_set_create_acl(dentry, dacl, pacl); | ||
1997 | error: | ||
1998 | if (fid) | ||
1999 | p9_client_clunk(fid); | ||
2000 | return err; | ||
2001 | } | ||
2002 | |||
2003 | static int | ||
2004 | v9fs_vfs_readlink_dotl(struct dentry *dentry, char *buffer, int buflen) | ||
2005 | { | ||
2006 | int retval; | ||
2007 | struct p9_fid *fid; | ||
2008 | char *target = NULL; | ||
2009 | |||
2010 | P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name); | ||
2011 | retval = -EPERM; | ||
2012 | fid = v9fs_fid_lookup(dentry); | ||
2013 | if (IS_ERR(fid)) | ||
2014 | return PTR_ERR(fid); | ||
2015 | |||
2016 | retval = p9_client_readlink(fid, &target); | ||
2017 | if (retval < 0) | ||
2018 | return retval; | ||
2019 | |||
2020 | strncpy(buffer, target, buflen); | ||
2021 | P9_DPRINTK(P9_DEBUG_VFS, "%s -> %s\n", dentry->d_name.name, buffer); | ||
2022 | |||
2023 | retval = strnlen(buffer, buflen); | ||
2024 | return retval; | ||
2025 | } | ||
2026 | |||
2027 | /** | ||
2028 | * v9fs_vfs_follow_link_dotl - follow a symlink path | ||
2029 | * @dentry: dentry for symlink | ||
2030 | * @nd: nameidata | ||
2031 | * | ||
2032 | */ | ||
2033 | |||
2034 | static void * | ||
2035 | v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) | ||
2036 | { | ||
2037 | int len = 0; | ||
2038 | char *link = __getname(); | ||
2039 | |||
2040 | P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name); | ||
2041 | |||
2042 | if (!link) | ||
2043 | link = ERR_PTR(-ENOMEM); | ||
2044 | else { | ||
2045 | len = v9fs_vfs_readlink_dotl(dentry, link, PATH_MAX); | ||
2046 | if (len < 0) { | ||
2047 | __putname(link); | ||
2048 | link = ERR_PTR(len); | ||
2049 | } else | ||
2050 | link[min(len, PATH_MAX-1)] = 0; | ||
2051 | } | ||
2052 | nd_set_link(nd, link); | ||
2053 | |||
2054 | return NULL; | ||
2055 | } | ||
2056 | |||
2057 | static const struct inode_operations v9fs_dir_inode_operations_dotu = { | 1245 | static const struct inode_operations v9fs_dir_inode_operations_dotu = { |
2058 | .create = v9fs_vfs_create, | 1246 | .create = v9fs_vfs_create, |
2059 | .lookup = v9fs_vfs_lookup, | 1247 | .lookup = v9fs_vfs_lookup, |
@@ -2068,25 +1256,6 @@ static const struct inode_operations v9fs_dir_inode_operations_dotu = { | |||
2068 | .setattr = v9fs_vfs_setattr, | 1256 | .setattr = v9fs_vfs_setattr, |
2069 | }; | 1257 | }; |
2070 | 1258 | ||
2071 | static const struct inode_operations v9fs_dir_inode_operations_dotl = { | ||
2072 | .create = v9fs_vfs_create_dotl, | ||
2073 | .lookup = v9fs_vfs_lookup, | ||
2074 | .link = v9fs_vfs_link_dotl, | ||
2075 | .symlink = v9fs_vfs_symlink_dotl, | ||
2076 | .unlink = v9fs_vfs_unlink, | ||
2077 | .mkdir = v9fs_vfs_mkdir_dotl, | ||
2078 | .rmdir = v9fs_vfs_rmdir, | ||
2079 | .mknod = v9fs_vfs_mknod_dotl, | ||
2080 | .rename = v9fs_vfs_rename, | ||
2081 | .getattr = v9fs_vfs_getattr_dotl, | ||
2082 | .setattr = v9fs_vfs_setattr_dotl, | ||
2083 | .setxattr = generic_setxattr, | ||
2084 | .getxattr = generic_getxattr, | ||
2085 | .removexattr = generic_removexattr, | ||
2086 | .listxattr = v9fs_listxattr, | ||
2087 | .check_acl = v9fs_check_acl, | ||
2088 | }; | ||
2089 | |||
2090 | static const struct inode_operations v9fs_dir_inode_operations = { | 1259 | static const struct inode_operations v9fs_dir_inode_operations = { |
2091 | .create = v9fs_vfs_create, | 1260 | .create = v9fs_vfs_create, |
2092 | .lookup = v9fs_vfs_lookup, | 1261 | .lookup = v9fs_vfs_lookup, |
@@ -2104,16 +1273,6 @@ static const struct inode_operations v9fs_file_inode_operations = { | |||
2104 | .setattr = v9fs_vfs_setattr, | 1273 | .setattr = v9fs_vfs_setattr, |
2105 | }; | 1274 | }; |
2106 | 1275 | ||
2107 | static const struct inode_operations v9fs_file_inode_operations_dotl = { | ||
2108 | .getattr = v9fs_vfs_getattr_dotl, | ||
2109 | .setattr = v9fs_vfs_setattr_dotl, | ||
2110 | .setxattr = generic_setxattr, | ||
2111 | .getxattr = generic_getxattr, | ||
2112 | .removexattr = generic_removexattr, | ||
2113 | .listxattr = v9fs_listxattr, | ||
2114 | .check_acl = v9fs_check_acl, | ||
2115 | }; | ||
2116 | |||
2117 | static const struct inode_operations v9fs_symlink_inode_operations = { | 1276 | static const struct inode_operations v9fs_symlink_inode_operations = { |
2118 | .readlink = generic_readlink, | 1277 | .readlink = generic_readlink, |
2119 | .follow_link = v9fs_vfs_follow_link, | 1278 | .follow_link = v9fs_vfs_follow_link, |
@@ -2122,14 +1281,3 @@ static const struct inode_operations v9fs_symlink_inode_operations = { | |||
2122 | .setattr = v9fs_vfs_setattr, | 1281 | .setattr = v9fs_vfs_setattr, |
2123 | }; | 1282 | }; |
2124 | 1283 | ||
2125 | static const struct inode_operations v9fs_symlink_inode_operations_dotl = { | ||
2126 | .readlink = v9fs_vfs_readlink_dotl, | ||
2127 | .follow_link = v9fs_vfs_follow_link_dotl, | ||
2128 | .put_link = v9fs_vfs_put_link, | ||
2129 | .getattr = v9fs_vfs_getattr_dotl, | ||
2130 | .setattr = v9fs_vfs_setattr_dotl, | ||
2131 | .setxattr = generic_setxattr, | ||
2132 | .getxattr = generic_getxattr, | ||
2133 | .removexattr = generic_removexattr, | ||
2134 | .listxattr = v9fs_listxattr, | ||
2135 | }; | ||