Commit 875d95ec9eb69ffb334116fb44d04d9a64dcbfbb
Committed by
Linus Torvalds
1 parent
0ec7ca41f6
Exists in
master
and in
7 other branches
[PATCH] fuse: fix compile without CONFIG_BLOCK
Randy Dunlap wote: > Should FUSE depend on BLOCK? Without that and with BLOCK=n, I get: > > inode.c:(.text+0x3acc5): undefined reference to `sb_set_blocksize' > inode.c:(.text+0x3a393): undefined reference to `get_sb_bdev' > fs/built-in.o:(.data+0xd718): undefined reference to `kill_block_super Most fuse filesystems work fine without block device support, so I think a better solution is to disable the 'fuseblk' filesystem type if BLOCK=n. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 33 additions and 10 deletions Side-by-side Diff
fs/fuse/inode.c
... | ... | @@ -535,8 +535,10 @@ |
535 | 535 | return -EINVAL; |
536 | 536 | |
537 | 537 | if (is_bdev) { |
538 | +#ifdef CONFIG_BLOCK | |
538 | 539 | if (!sb_set_blocksize(sb, d.blksize)) |
539 | 540 | return -EINVAL; |
541 | +#endif | |
540 | 542 | } else { |
541 | 543 | sb->s_blocksize = PAGE_CACHE_SIZE; |
542 | 544 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
... | ... | @@ -629,6 +631,14 @@ |
629 | 631 | return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); |
630 | 632 | } |
631 | 633 | |
634 | +static struct file_system_type fuse_fs_type = { | |
635 | + .owner = THIS_MODULE, | |
636 | + .name = "fuse", | |
637 | + .get_sb = fuse_get_sb, | |
638 | + .kill_sb = kill_anon_super, | |
639 | +}; | |
640 | + | |
641 | +#ifdef CONFIG_BLOCK | |
632 | 642 | static int fuse_get_sb_blk(struct file_system_type *fs_type, |
633 | 643 | int flags, const char *dev_name, |
634 | 644 | void *raw_data, struct vfsmount *mnt) |
... | ... | @@ -637,13 +647,6 @@ |
637 | 647 | mnt); |
638 | 648 | } |
639 | 649 | |
640 | -static struct file_system_type fuse_fs_type = { | |
641 | - .owner = THIS_MODULE, | |
642 | - .name = "fuse", | |
643 | - .get_sb = fuse_get_sb, | |
644 | - .kill_sb = kill_anon_super, | |
645 | -}; | |
646 | - | |
647 | 650 | static struct file_system_type fuseblk_fs_type = { |
648 | 651 | .owner = THIS_MODULE, |
649 | 652 | .name = "fuseblk", |
... | ... | @@ -652,6 +655,26 @@ |
652 | 655 | .fs_flags = FS_REQUIRES_DEV, |
653 | 656 | }; |
654 | 657 | |
658 | +static inline int register_fuseblk(void) | |
659 | +{ | |
660 | + return register_filesystem(&fuseblk_fs_type); | |
661 | +} | |
662 | + | |
663 | +static inline void unregister_fuseblk(void) | |
664 | +{ | |
665 | + unregister_filesystem(&fuseblk_fs_type); | |
666 | +} | |
667 | +#else | |
668 | +static inline int register_fuseblk(void) | |
669 | +{ | |
670 | + return 0; | |
671 | +} | |
672 | + | |
673 | +static inline void unregister_fuseblk(void) | |
674 | +{ | |
675 | +} | |
676 | +#endif | |
677 | + | |
655 | 678 | static decl_subsys(fuse, NULL, NULL); |
656 | 679 | static decl_subsys(connections, NULL, NULL); |
657 | 680 | |
... | ... | @@ -673,7 +696,7 @@ |
673 | 696 | if (err) |
674 | 697 | goto out; |
675 | 698 | |
676 | - err = register_filesystem(&fuseblk_fs_type); | |
699 | + err = register_fuseblk(); | |
677 | 700 | if (err) |
678 | 701 | goto out_unreg; |
679 | 702 | |
... | ... | @@ -688,7 +711,7 @@ |
688 | 711 | return 0; |
689 | 712 | |
690 | 713 | out_unreg2: |
691 | - unregister_filesystem(&fuseblk_fs_type); | |
714 | + unregister_fuseblk(); | |
692 | 715 | out_unreg: |
693 | 716 | unregister_filesystem(&fuse_fs_type); |
694 | 717 | out: |
... | ... | @@ -698,7 +721,7 @@ |
698 | 721 | static void fuse_fs_cleanup(void) |
699 | 722 | { |
700 | 723 | unregister_filesystem(&fuse_fs_type); |
701 | - unregister_filesystem(&fuseblk_fs_type); | |
724 | + unregister_fuseblk(); | |
702 | 725 | kmem_cache_destroy(fuse_inode_cachep); |
703 | 726 | } |
704 | 727 |