aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/inode.c')
-rw-r--r--kernel/inode.c61
1 files changed, 43 insertions, 18 deletions
diff --git a/kernel/inode.c b/kernel/inode.c
index d40f502..57ebb51 100644
--- a/kernel/inode.c
+++ b/kernel/inode.c
@@ -52,7 +52,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
struct inode *inode;
struct fuse_inode *fi;
- inode = kmem_cache_alloc(fuse_inode_cachep, SLAB_KERNEL);
+ inode = kmem_cache_alloc(fuse_inode_cachep, GFP_KERNEL);
if (!inode)
return NULL;
@@ -637,8 +637,10 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
return -EINVAL;
if (is_bdev) {
+#ifdef CONFIG_BLOCK
if (!sb_set_blocksize(sb, d.blksize))
return -EINVAL;
+#endif
} else {
sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -734,7 +736,24 @@ static int fuse_get_sb(struct file_system_type *fs_type,
{
return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt);
}
+#else
+static struct super_block *fuse_get_sb(struct file_system_type *fs_type,
+ int flags, const char *dev_name,
+ void *raw_data)
+{
+ return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super);
+}
+#endif
+
+static struct file_system_type fuse_fs_type = {
+ .owner = THIS_MODULE,
+ .name = "fuse",
+ .get_sb = fuse_get_sb,
+ .kill_sb = kill_anon_super,
+};
+#ifdef CONFIG_BLOCK
+#ifdef KERNEL_2_6_18_PLUS
static int fuse_get_sb_blk(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *raw_data, struct vfsmount *mnt)
@@ -743,13 +762,6 @@ static int fuse_get_sb_blk(struct file_system_type *fs_type,
mnt);
}
#else
-static struct super_block *fuse_get_sb(struct file_system_type *fs_type,
- int flags, const char *dev_name,
- void *raw_data)
-{
- return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super);
-}
-
static struct super_block *fuse_get_sb_blk(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *raw_data)
@@ -759,13 +771,6 @@ static struct super_block *fuse_get_sb_blk(struct file_system_type *fs_type,
}
#endif
-static struct file_system_type fuse_fs_type = {
- .owner = THIS_MODULE,
- .name = "fuse",
- .get_sb = fuse_get_sb,
- .kill_sb = kill_anon_super,
-};
-
static struct file_system_type fuseblk_fs_type = {
.owner = THIS_MODULE,
.name = "fuseblk",
@@ -774,6 +779,26 @@ static struct file_system_type fuseblk_fs_type = {
.fs_flags = FS_REQUIRES_DEV,
};
+static inline int register_fuseblk(void)
+{
+ return register_filesystem(&fuseblk_fs_type);
+}
+
+static inline void unregister_fuseblk(void)
+{
+ unregister_filesystem(&fuseblk_fs_type);
+}
+#else
+static inline int register_fuseblk(void)
+{
+ return 0;
+}
+
+static inline void unregister_fuseblk(void)
+{
+}
+#endif
+
#ifndef HAVE_FS_SUBSYS
static decl_subsys(fs, NULL, NULL);
#endif
@@ -798,7 +823,7 @@ static int __init fuse_fs_init(void)
if (err)
goto out;
- err = register_filesystem(&fuseblk_fs_type);
+ err = register_fuseblk();
if (err)
goto out_unreg;
@@ -813,7 +838,7 @@ static int __init fuse_fs_init(void)
return 0;
out_unreg2:
- unregister_filesystem(&fuseblk_fs_type);
+ unregister_fuseblk();
out_unreg:
unregister_filesystem(&fuse_fs_type);
out:
@@ -823,7 +848,7 @@ static int __init fuse_fs_init(void)
static void fuse_fs_cleanup(void)
{
unregister_filesystem(&fuse_fs_type);
- unregister_filesystem(&fuseblk_fs_type);
+ unregister_fuseblk();
kmem_cache_destroy(fuse_inode_cachep);
}