aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-12-06 23:35:44 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:31 -0500
commitd6392f873f1d09974d5c92c52715fa422ad7c625 (patch)
treece94449b7f2a62162fdbef0e4324c2ad8d66adbe /fs/fuse
parentbdcf25080438ba71bb24b885e7c102de72c25c9d (diff)
[PATCH] fuse: add support for block device based filesystems
I never intended this, but people started using fuse to implement block device based "real" filesystems (ntfs-3g, zfs). The following four patches add better support for these kinds of filesystems. Unlike "normal" fuse filesystems, using this feature should require superuser privileges (enforced by the fusermount utility). Thanks to Szabolcs Szakacsits for the input and testing. This patch adds a 'fuseblk' filesystem type, which is only different from the 'fuse' filesystem type in how the 'dev_name' mount argument is interpreted. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/inode.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 2bdc652b8b46..38cf97d6469c 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -591,6 +591,14 @@ static int fuse_get_sb(struct file_system_type *fs_type,
591 return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); 591 return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt);
592} 592}
593 593
594static int fuse_get_sb_blk(struct file_system_type *fs_type,
595 int flags, const char *dev_name,
596 void *raw_data, struct vfsmount *mnt)
597{
598 return get_sb_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super,
599 mnt);
600}
601
594static struct file_system_type fuse_fs_type = { 602static struct file_system_type fuse_fs_type = {
595 .owner = THIS_MODULE, 603 .owner = THIS_MODULE,
596 .name = "fuse", 604 .name = "fuse",
@@ -598,6 +606,14 @@ static struct file_system_type fuse_fs_type = {
598 .kill_sb = kill_anon_super, 606 .kill_sb = kill_anon_super,
599}; 607};
600 608
609static struct file_system_type fuseblk_fs_type = {
610 .owner = THIS_MODULE,
611 .name = "fuseblk",
612 .get_sb = fuse_get_sb_blk,
613 .kill_sb = kill_block_super,
614 .fs_flags = FS_REQUIRES_DEV,
615};
616
601static decl_subsys(fuse, NULL, NULL); 617static decl_subsys(fuse, NULL, NULL);
602static decl_subsys(connections, NULL, NULL); 618static decl_subsys(connections, NULL, NULL);
603 619
@@ -617,24 +633,34 @@ static int __init fuse_fs_init(void)
617 633
618 err = register_filesystem(&fuse_fs_type); 634 err = register_filesystem(&fuse_fs_type);
619 if (err) 635 if (err)
620 printk("fuse: failed to register filesystem\n"); 636 goto out;
621 else { 637
622 fuse_inode_cachep = kmem_cache_create("fuse_inode", 638 err = register_filesystem(&fuseblk_fs_type);
623 sizeof(struct fuse_inode), 639 if (err)
624 0, SLAB_HWCACHE_ALIGN, 640 goto out_unreg;
625 fuse_inode_init_once, NULL); 641
626 if (!fuse_inode_cachep) { 642 fuse_inode_cachep = kmem_cache_create("fuse_inode",
627 unregister_filesystem(&fuse_fs_type); 643 sizeof(struct fuse_inode),
628 err = -ENOMEM; 644 0, SLAB_HWCACHE_ALIGN,
629 } 645 fuse_inode_init_once, NULL);
630 } 646 err = -ENOMEM;
647 if (!fuse_inode_cachep)
648 goto out_unreg2;
649
650 return 0;
631 651
652 out_unreg2:
653 unregister_filesystem(&fuseblk_fs_type);
654 out_unreg:
655 unregister_filesystem(&fuse_fs_type);
656 out:
632 return err; 657 return err;
633} 658}
634 659
635static void fuse_fs_cleanup(void) 660static void fuse_fs_cleanup(void)
636{ 661{
637 unregister_filesystem(&fuse_fs_type); 662 unregister_filesystem(&fuse_fs_type);
663 unregister_filesystem(&fuseblk_fs_type);
638 kmem_cache_destroy(fuse_inode_cachep); 664 kmem_cache_destroy(fuse_inode_cachep);
639} 665}
640 666