Commit 3c26ff6e499ee7e6f9f2bc7da5f2f30d80862ecf
1 parent
fc14f2fef6
Exists in
master
and in
39 other branches
convert get_sb_nodev() users
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 17 changed files with 87 additions and 73 deletions Side-by-side Diff
- drivers/staging/autofs/init.c
- drivers/staging/pohmelfs/inode.c
- drivers/staging/smbfs/inode.c
- fs/autofs4/init.c
- fs/coda/inode.c
- fs/exofs/super.c
- fs/fuse/inode.c
- fs/hostfs/hostfs_kern.c
- fs/hppfs/hppfs.c
- fs/hugetlbfs/inode.c
- fs/ncpfs/inode.c
- fs/ocfs2/dlmfs/dlmfs.c
- fs/ramfs/inode.c
- fs/super.c
- include/linux/fs.h
- include/linux/ramfs.h
- mm/shmem.c
drivers/staging/autofs/init.c
... | ... | @@ -14,16 +14,16 @@ |
14 | 14 | #include <linux/init.h> |
15 | 15 | #include "autofs_i.h" |
16 | 16 | |
17 | -static int autofs_get_sb(struct file_system_type *fs_type, | |
18 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
17 | +static struct dentry *autofs_mount(struct file_system_type *fs_type, | |
18 | + int flags, const char *dev_name, void *data) | |
19 | 19 | { |
20 | - return get_sb_nodev(fs_type, flags, data, autofs_fill_super, mnt); | |
20 | + return mount_nodev(fs_type, flags, data, autofs_fill_super); | |
21 | 21 | } |
22 | 22 | |
23 | 23 | static struct file_system_type autofs_fs_type = { |
24 | 24 | .owner = THIS_MODULE, |
25 | 25 | .name = "autofs", |
26 | - .get_sb = autofs_get_sb, | |
26 | + .mount = autofs_mount, | |
27 | 27 | .kill_sb = autofs_kill_sb, |
28 | 28 | }; |
29 | 29 |
drivers/staging/pohmelfs/inode.c
... | ... | @@ -1937,11 +1937,10 @@ |
1937 | 1937 | /* |
1938 | 1938 | * Some VFS magic here... |
1939 | 1939 | */ |
1940 | -static int pohmelfs_get_sb(struct file_system_type *fs_type, | |
1941 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
1940 | +static struct dentry *pohmelfs_mount(struct file_system_type *fs_type, | |
1941 | + int flags, const char *dev_name, void *data) | |
1942 | 1942 | { |
1943 | - return get_sb_nodev(fs_type, flags, data, pohmelfs_fill_super, | |
1944 | - mnt); | |
1943 | + return mount_nodev(fs_type, flags, data, pohmelfs_fill_super); | |
1945 | 1944 | } |
1946 | 1945 | |
1947 | 1946 | /* |
... | ... | @@ -1958,7 +1957,7 @@ |
1958 | 1957 | static struct file_system_type pohmel_fs_type = { |
1959 | 1958 | .owner = THIS_MODULE, |
1960 | 1959 | .name = "pohmel", |
1961 | - .get_sb = pohmelfs_get_sb, | |
1960 | + .mount = pohmelfs_mount, | |
1962 | 1961 | .kill_sb = pohmelfs_kill_super, |
1963 | 1962 | }; |
1964 | 1963 |
drivers/staging/smbfs/inode.c
... | ... | @@ -793,16 +793,16 @@ |
793 | 793 | return error; |
794 | 794 | } |
795 | 795 | |
796 | -static int smb_get_sb(struct file_system_type *fs_type, | |
797 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
796 | +static struct dentry *smb_mount(struct file_system_type *fs_type, | |
797 | + int flags, const char *dev_name, void *data) | |
798 | 798 | { |
799 | - return get_sb_nodev(fs_type, flags, data, smb_fill_super, mnt); | |
799 | + return mount_nodev(fs_type, flags, data, smb_fill_super); | |
800 | 800 | } |
801 | 801 | |
802 | 802 | static struct file_system_type smb_fs_type = { |
803 | 803 | .owner = THIS_MODULE, |
804 | 804 | .name = "smbfs", |
805 | - .get_sb = smb_get_sb, | |
805 | + .mount = smb_mount, | |
806 | 806 | .kill_sb = kill_anon_super, |
807 | 807 | .fs_flags = FS_BINARY_MOUNTDATA, |
808 | 808 | }; |
fs/autofs4/init.c
... | ... | @@ -14,16 +14,16 @@ |
14 | 14 | #include <linux/init.h> |
15 | 15 | #include "autofs_i.h" |
16 | 16 | |
17 | -static int autofs_get_sb(struct file_system_type *fs_type, | |
18 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
17 | +static struct dentry *autofs_mount(struct file_system_type *fs_type, | |
18 | + int flags, const char *dev_name, void *data) | |
19 | 19 | { |
20 | - return get_sb_nodev(fs_type, flags, data, autofs4_fill_super, mnt); | |
20 | + return mount_nodev(fs_type, flags, data, autofs4_fill_super); | |
21 | 21 | } |
22 | 22 | |
23 | 23 | static struct file_system_type autofs_fs_type = { |
24 | 24 | .owner = THIS_MODULE, |
25 | 25 | .name = "autofs", |
26 | - .get_sb = autofs_get_sb, | |
26 | + .mount = autofs_mount, | |
27 | 27 | .kill_sb = autofs4_kill_sb, |
28 | 28 | }; |
29 | 29 |
fs/coda/inode.c
... | ... | @@ -306,16 +306,16 @@ |
306 | 306 | |
307 | 307 | /* init_coda: used by filesystems.c to register coda */ |
308 | 308 | |
309 | -static int coda_get_sb(struct file_system_type *fs_type, | |
310 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
309 | +static struct dentry *coda_mount(struct file_system_type *fs_type, | |
310 | + int flags, const char *dev_name, void *data) | |
311 | 311 | { |
312 | - return get_sb_nodev(fs_type, flags, data, coda_fill_super, mnt); | |
312 | + return mount_nodev(fs_type, flags, data, coda_fill_super); | |
313 | 313 | } |
314 | 314 | |
315 | 315 | struct file_system_type coda_fs_type = { |
316 | 316 | .owner = THIS_MODULE, |
317 | 317 | .name = "coda", |
318 | - .get_sb = coda_get_sb, | |
318 | + .mount = coda_mount, | |
319 | 319 | .kill_sb = kill_anon_super, |
320 | 320 | .fs_flags = FS_BINARY_MOUNTDATA, |
321 | 321 | }; |
fs/exofs/super.c
... | ... | @@ -659,19 +659,19 @@ |
659 | 659 | /* |
660 | 660 | * Set up the superblock (calls exofs_fill_super eventually) |
661 | 661 | */ |
662 | -static int exofs_get_sb(struct file_system_type *type, | |
662 | +static struct dentry *exofs_mount(struct file_system_type *type, | |
663 | 663 | int flags, const char *dev_name, |
664 | - void *data, struct vfsmount *mnt) | |
664 | + void *data) | |
665 | 665 | { |
666 | 666 | struct exofs_mountopt opts; |
667 | 667 | int ret; |
668 | 668 | |
669 | 669 | ret = parse_options(data, &opts); |
670 | 670 | if (ret) |
671 | - return ret; | |
671 | + return ERR_PTR(ret); | |
672 | 672 | |
673 | 673 | opts.dev_name = dev_name; |
674 | - return get_sb_nodev(type, flags, &opts, exofs_fill_super, mnt); | |
674 | + return mount_nodev(type, flags, &opts, exofs_fill_super); | |
675 | 675 | } |
676 | 676 | |
677 | 677 | /* |
... | ... | @@ -809,7 +809,7 @@ |
809 | 809 | static struct file_system_type exofs_type = { |
810 | 810 | .owner = THIS_MODULE, |
811 | 811 | .name = "exofs", |
812 | - .get_sb = exofs_get_sb, | |
812 | + .mount = exofs_mount, | |
813 | 813 | .kill_sb = generic_shutdown_super, |
814 | 814 | }; |
815 | 815 |
fs/fuse/inode.c
... | ... | @@ -1041,11 +1041,11 @@ |
1041 | 1041 | return err; |
1042 | 1042 | } |
1043 | 1043 | |
1044 | -static int fuse_get_sb(struct file_system_type *fs_type, | |
1044 | +static struct dentry *fuse_mount(struct file_system_type *fs_type, | |
1045 | 1045 | int flags, const char *dev_name, |
1046 | - void *raw_data, struct vfsmount *mnt) | |
1046 | + void *raw_data) | |
1047 | 1047 | { |
1048 | - return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); | |
1048 | + return mount_nodev(fs_type, flags, raw_data, fuse_fill_super); | |
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | static void fuse_kill_sb_anon(struct super_block *sb) |
... | ... | @@ -1065,7 +1065,7 @@ |
1065 | 1065 | .owner = THIS_MODULE, |
1066 | 1066 | .name = "fuse", |
1067 | 1067 | .fs_flags = FS_HAS_SUBTYPE, |
1068 | - .get_sb = fuse_get_sb, | |
1068 | + .mount = fuse_mount, | |
1069 | 1069 | .kill_sb = fuse_kill_sb_anon, |
1070 | 1070 | }; |
1071 | 1071 |
fs/hostfs/hostfs_kern.c
... | ... | @@ -962,11 +962,11 @@ |
962 | 962 | return err; |
963 | 963 | } |
964 | 964 | |
965 | -static int hostfs_read_sb(struct file_system_type *type, | |
965 | +static struct dentry *hostfs_read_sb(struct file_system_type *type, | |
966 | 966 | int flags, const char *dev_name, |
967 | - void *data, struct vfsmount *mnt) | |
967 | + void *data) | |
968 | 968 | { |
969 | - return get_sb_nodev(type, flags, data, hostfs_fill_sb_common, mnt); | |
969 | + return mount_nodev(type, flags, data, hostfs_fill_sb_common); | |
970 | 970 | } |
971 | 971 | |
972 | 972 | static void hostfs_kill_sb(struct super_block *s) |
... | ... | @@ -978,7 +978,7 @@ |
978 | 978 | static struct file_system_type hostfs_type = { |
979 | 979 | .owner = THIS_MODULE, |
980 | 980 | .name = "hostfs", |
981 | - .get_sb = hostfs_read_sb, | |
981 | + .mount = hostfs_read_sb, | |
982 | 982 | .kill_sb = hostfs_kill_sb, |
983 | 983 | .fs_flags = 0, |
984 | 984 | }; |
fs/hppfs/hppfs.c
... | ... | @@ -748,17 +748,17 @@ |
748 | 748 | return(err); |
749 | 749 | } |
750 | 750 | |
751 | -static int hppfs_read_super(struct file_system_type *type, | |
751 | +static struct dentry *hppfs_read_super(struct file_system_type *type, | |
752 | 752 | int flags, const char *dev_name, |
753 | - void *data, struct vfsmount *mnt) | |
753 | + void *data) | |
754 | 754 | { |
755 | - return get_sb_nodev(type, flags, data, hppfs_fill_super, mnt); | |
755 | + return mount_nodev(type, flags, data, hppfs_fill_super); | |
756 | 756 | } |
757 | 757 | |
758 | 758 | static struct file_system_type hppfs_type = { |
759 | 759 | .owner = THIS_MODULE, |
760 | 760 | .name = "hppfs", |
761 | - .get_sb = hppfs_read_super, | |
761 | + .mount = hppfs_read_super, | |
762 | 762 | .kill_sb = kill_anon_super, |
763 | 763 | .fs_flags = 0, |
764 | 764 | }; |
fs/hugetlbfs/inode.c
... | ... | @@ -896,15 +896,15 @@ |
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | -static int hugetlbfs_get_sb(struct file_system_type *fs_type, | |
900 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
899 | +static struct dentry *hugetlbfs_mount(struct file_system_type *fs_type, | |
900 | + int flags, const char *dev_name, void *data) | |
901 | 901 | { |
902 | - return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super, mnt); | |
902 | + return mount_nodev(fs_type, flags, data, hugetlbfs_fill_super); | |
903 | 903 | } |
904 | 904 | |
905 | 905 | static struct file_system_type hugetlbfs_fs_type = { |
906 | 906 | .name = "hugetlbfs", |
907 | - .get_sb = hugetlbfs_get_sb, | |
907 | + .mount = hugetlbfs_mount, | |
908 | 908 | .kill_sb = kill_litter_super, |
909 | 909 | }; |
910 | 910 |
fs/ncpfs/inode.c
... | ... | @@ -1020,16 +1020,16 @@ |
1020 | 1020 | return result; |
1021 | 1021 | } |
1022 | 1022 | |
1023 | -static int ncp_get_sb(struct file_system_type *fs_type, | |
1024 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
1023 | +static struct dentry *ncp_mount(struct file_system_type *fs_type, | |
1024 | + int flags, const char *dev_name, void *data) | |
1025 | 1025 | { |
1026 | - return get_sb_nodev(fs_type, flags, data, ncp_fill_super, mnt); | |
1026 | + return mount_nodev(fs_type, flags, data, ncp_fill_super); | |
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | static struct file_system_type ncp_fs_type = { |
1030 | 1030 | .owner = THIS_MODULE, |
1031 | 1031 | .name = "ncpfs", |
1032 | - .get_sb = ncp_get_sb, | |
1032 | + .mount = ncp_mount, | |
1033 | 1033 | .kill_sb = kill_anon_super, |
1034 | 1034 | .fs_flags = FS_BINARY_MOUNTDATA, |
1035 | 1035 | }; |
fs/ocfs2/dlmfs/dlmfs.c
... | ... | @@ -643,16 +643,16 @@ |
643 | 643 | .setattr = dlmfs_file_setattr, |
644 | 644 | }; |
645 | 645 | |
646 | -static int dlmfs_get_sb(struct file_system_type *fs_type, | |
647 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
646 | +static struct dentry *dlmfs_mount(struct file_system_type *fs_type, | |
647 | + int flags, const char *dev_name, void *data) | |
648 | 648 | { |
649 | - return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super, mnt); | |
649 | + return mount_nodev(fs_type, flags, data, dlmfs_fill_super); | |
650 | 650 | } |
651 | 651 | |
652 | 652 | static struct file_system_type dlmfs_fs_type = { |
653 | 653 | .owner = THIS_MODULE, |
654 | 654 | .name = "ocfs2_dlmfs", |
655 | - .get_sb = dlmfs_get_sb, | |
655 | + .mount = dlmfs_mount, | |
656 | 656 | .kill_sb = kill_litter_super, |
657 | 657 | }; |
658 | 658 |
fs/ramfs/inode.c
... | ... | @@ -255,17 +255,16 @@ |
255 | 255 | return err; |
256 | 256 | } |
257 | 257 | |
258 | -int ramfs_get_sb(struct file_system_type *fs_type, | |
259 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
258 | +struct dentry *ramfs_mount(struct file_system_type *fs_type, | |
259 | + int flags, const char *dev_name, void *data) | |
260 | 260 | { |
261 | - return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt); | |
261 | + return mount_nodev(fs_type, flags, data, ramfs_fill_super); | |
262 | 262 | } |
263 | 263 | |
264 | -static int rootfs_get_sb(struct file_system_type *fs_type, | |
265 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
264 | +static struct dentry *rootfs_mount(struct file_system_type *fs_type, | |
265 | + int flags, const char *dev_name, void *data) | |
266 | 266 | { |
267 | - return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super, | |
268 | - mnt); | |
267 | + return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); | |
269 | 268 | } |
270 | 269 | |
271 | 270 | static void ramfs_kill_sb(struct super_block *sb) |
272 | 271 | |
... | ... | @@ -276,12 +275,12 @@ |
276 | 275 | |
277 | 276 | static struct file_system_type ramfs_fs_type = { |
278 | 277 | .name = "ramfs", |
279 | - .get_sb = ramfs_get_sb, | |
278 | + .mount = ramfs_mount, | |
280 | 279 | .kill_sb = ramfs_kill_sb, |
281 | 280 | }; |
282 | 281 | static struct file_system_type rootfs_fs_type = { |
283 | 282 | .name = "rootfs", |
284 | - .get_sb = rootfs_get_sb, | |
283 | + .mount = rootfs_mount, | |
285 | 284 | .kill_sb = kill_litter_super, |
286 | 285 | }; |
287 | 286 |
fs/super.c
... | ... | @@ -870,29 +870,42 @@ |
870 | 870 | EXPORT_SYMBOL(kill_block_super); |
871 | 871 | #endif |
872 | 872 | |
873 | -int get_sb_nodev(struct file_system_type *fs_type, | |
873 | +struct dentry *mount_nodev(struct file_system_type *fs_type, | |
874 | 874 | int flags, void *data, |
875 | - int (*fill_super)(struct super_block *, void *, int), | |
876 | - struct vfsmount *mnt) | |
875 | + int (*fill_super)(struct super_block *, void *, int)) | |
877 | 876 | { |
878 | 877 | int error; |
879 | 878 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); |
880 | 879 | |
881 | 880 | if (IS_ERR(s)) |
882 | - return PTR_ERR(s); | |
881 | + return ERR_CAST(s); | |
883 | 882 | |
884 | 883 | s->s_flags = flags; |
885 | 884 | |
886 | 885 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
887 | 886 | if (error) { |
888 | 887 | deactivate_locked_super(s); |
889 | - return error; | |
888 | + return ERR_PTR(error); | |
890 | 889 | } |
891 | 890 | s->s_flags |= MS_ACTIVE; |
892 | - simple_set_mnt(mnt, s); | |
893 | - return 0; | |
891 | + return dget(s->s_root); | |
894 | 892 | } |
893 | +EXPORT_SYMBOL(mount_nodev); | |
895 | 894 | |
895 | +int get_sb_nodev(struct file_system_type *fs_type, | |
896 | + int flags, void *data, | |
897 | + int (*fill_super)(struct super_block *, void *, int), | |
898 | + struct vfsmount *mnt) | |
899 | +{ | |
900 | + struct dentry *root; | |
901 | + | |
902 | + root = mount_nodev(fs_type, flags, data, fill_super); | |
903 | + if (IS_ERR(root)) | |
904 | + return PTR_ERR(root); | |
905 | + mnt->mnt_root = root; | |
906 | + mnt->mnt_sb = root->d_sb; | |
907 | + return 0; | |
908 | +} | |
896 | 909 | EXPORT_SYMBOL(get_sb_nodev); |
897 | 910 | |
898 | 911 | static int compare_single(struct super_block *s, void *p) |
include/linux/fs.h
... | ... | @@ -1806,6 +1806,9 @@ |
1806 | 1806 | int flags, void *data, |
1807 | 1807 | int (*fill_super)(struct super_block *, void *, int), |
1808 | 1808 | struct vfsmount *mnt); |
1809 | +extern struct dentry *mount_nodev(struct file_system_type *fs_type, | |
1810 | + int flags, void *data, | |
1811 | + int (*fill_super)(struct super_block *, void *, int)); | |
1809 | 1812 | extern int get_sb_nodev(struct file_system_type *fs_type, |
1810 | 1813 | int flags, void *data, |
1811 | 1814 | int (*fill_super)(struct super_block *, void *, int), |
include/linux/ramfs.h
... | ... | @@ -3,8 +3,8 @@ |
3 | 3 | |
4 | 4 | struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, |
5 | 5 | int mode, dev_t dev); |
6 | -extern int ramfs_get_sb(struct file_system_type *fs_type, | |
7 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt); | |
6 | +extern struct dentry *ramfs_mount(struct file_system_type *fs_type, | |
7 | + int flags, const char *dev_name, void *data); | |
8 | 8 | |
9 | 9 | #ifndef CONFIG_MMU |
10 | 10 | extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); |
mm/shmem.c
... | ... | @@ -2538,16 +2538,16 @@ |
2538 | 2538 | }; |
2539 | 2539 | |
2540 | 2540 | |
2541 | -static int shmem_get_sb(struct file_system_type *fs_type, | |
2542 | - int flags, const char *dev_name, void *data, struct vfsmount *mnt) | |
2541 | +static struct dentry *shmem_mount(struct file_system_type *fs_type, | |
2542 | + int flags, const char *dev_name, void *data) | |
2543 | 2543 | { |
2544 | - return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt); | |
2544 | + return mount_nodev(fs_type, flags, data, shmem_fill_super); | |
2545 | 2545 | } |
2546 | 2546 | |
2547 | 2547 | static struct file_system_type tmpfs_fs_type = { |
2548 | 2548 | .owner = THIS_MODULE, |
2549 | 2549 | .name = "tmpfs", |
2550 | - .get_sb = shmem_get_sb, | |
2550 | + .mount = shmem_mount, | |
2551 | 2551 | .kill_sb = kill_litter_super, |
2552 | 2552 | }; |
2553 | 2553 | |
... | ... | @@ -2643,7 +2643,7 @@ |
2643 | 2643 | |
2644 | 2644 | static struct file_system_type tmpfs_fs_type = { |
2645 | 2645 | .name = "tmpfs", |
2646 | - .get_sb = ramfs_get_sb, | |
2646 | + .mount = ramfs_mount, | |
2647 | 2647 | .kill_sb = kill_litter_super, |
2648 | 2648 | }; |
2649 | 2649 |