aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2007-05-08 03:25:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:01 -0400
commit79c0b2df79eb56fc71e54c75cd7fb3acf84370f9 (patch)
treef19be816fef3565b7f9cc746786e29fee0ac62e6 /fs/super.c
parent880afc4d76af452267174b5989943f081c1db2c0 (diff)
add filesystem subtype support
There's a slight problem with filesystem type representation in fuse based filesystems. From the kernel's view, there are just two filesystem types: fuse and fuseblk. From the user's view there are lots of different filesystem types. The user is not even much concerned if the filesystem is fuse based or not. So there's a conflict of interest in how this should be represented in fstab, mtab and /proc/mounts. The current scheme is to encode the real filesystem type in the mount source. So an sshfs mount looks like this: sshfs#user@server:/ /mnt/server fuse rw,nosuid,nodev,... This url-ish syntax works OK for sshfs and similar filesystems. However for block device based filesystems (ntfs-3g, zfs) it doesn't work, since the kernel expects the mount source to be a real device name. A possibly better scheme would be to encode the real type in the type field as "type.subtype". So fuse mounts would look like this: /dev/hda1 /mnt/windows fuseblk.ntfs-3g rw,... user@server:/ /mnt/server fuse.sshfs rw,nosuid,nodev,... This patch adds the necessary code to the kernel so that this can be correctly displayed in /proc/mounts. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/super.c b/fs/super.c
index 8341e4e1d738..5260d620c555 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -107,6 +107,7 @@ out:
107static inline void destroy_super(struct super_block *s) 107static inline void destroy_super(struct super_block *s)
108{ 108{
109 security_sb_free(s); 109 security_sb_free(s);
110 kfree(s->s_subtype);
110 kfree(s); 111 kfree(s);
111} 112}
112 113
@@ -907,6 +908,29 @@ out:
907 908
908EXPORT_SYMBOL_GPL(vfs_kern_mount); 909EXPORT_SYMBOL_GPL(vfs_kern_mount);
909 910
911static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype)
912{
913 int err;
914 const char *subtype = strchr(fstype, '.');
915 if (subtype) {
916 subtype++;
917 err = -EINVAL;
918 if (!subtype[0])
919 goto err;
920 } else
921 subtype = "";
922
923 mnt->mnt_sb->s_subtype = kstrdup(subtype, GFP_KERNEL);
924 err = -ENOMEM;
925 if (!mnt->mnt_sb->s_subtype)
926 goto err;
927 return mnt;
928
929 err:
930 mntput(mnt);
931 return ERR_PTR(err);
932}
933
910struct vfsmount * 934struct vfsmount *
911do_kern_mount(const char *fstype, int flags, const char *name, void *data) 935do_kern_mount(const char *fstype, int flags, const char *name, void *data)
912{ 936{
@@ -915,6 +939,9 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
915 if (!type) 939 if (!type)
916 return ERR_PTR(-ENODEV); 940 return ERR_PTR(-ENODEV);
917 mnt = vfs_kern_mount(type, flags, name, data); 941 mnt = vfs_kern_mount(type, flags, name, data);
942 if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
943 !mnt->mnt_sb->s_subtype)
944 mnt = fs_set_subtype(mnt, fstype);
918 put_filesystem(type); 945 put_filesystem(type);
919 return mnt; 946 return mnt;
920} 947}