| 1 | --- a/fs/yaffs2/yaffs_vfs_glue.c |
| 2 | +++ b/fs/yaffs2/yaffs_vfs_glue.c |
| 3 | @@ -72,7 +72,7 @@ |
| 4 | #include <linux/init.h> |
| 5 | #include <linux/fs.h> |
| 6 | #include <linux/proc_fs.h> |
| 7 | -#include <linux/smp_lock.h> |
| 8 | +#include <linux/mutex.h> |
| 9 | #include <linux/pagemap.h> |
| 10 | #include <linux/mtd/mtd.h> |
| 11 | #include <linux/interrupt.h> |
| 12 | @@ -97,6 +97,8 @@ |
| 13 | |
| 14 | #include <asm/div64.h> |
| 15 | |
| 16 | +static DEFINE_MUTEX(yaffs_mutex); |
| 17 | + |
| 18 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) |
| 19 | |
| 20 | #include <linux/statfs.h> |
| 21 | @@ -1538,7 +1540,7 @@ static loff_t yaffs_dir_llseek(struct fi |
| 22 | { |
| 23 | long long retval; |
| 24 | |
| 25 | - lock_kernel(); |
| 26 | + mutex_lock(&yaffs_mutex); |
| 27 | |
| 28 | switch (origin){ |
| 29 | case 2: |
| 30 | @@ -1555,7 +1557,7 @@ static loff_t yaffs_dir_llseek(struct fi |
| 31 | |
| 32 | retval = offset; |
| 33 | } |
| 34 | - unlock_kernel(); |
| 35 | + mutex_unlock(&yaffs_mutex); |
| 36 | return retval; |
| 37 | } |
| 38 | |
| 39 | @@ -3087,98 +3089,52 @@ static struct super_block *yaffs_interna |
| 40 | return sb; |
| 41 | } |
| 42 | |
| 43 | - |
| 44 | -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) |
| 45 | static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data, |
| 46 | int silent) |
| 47 | { |
| 48 | return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL; |
| 49 | } |
| 50 | |
| 51 | -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) |
| 52 | -static int yaffs_read_super(struct file_system_type *fs, |
| 53 | +static struct dentry *yaffs_read_super(struct file_system_type *fs, |
| 54 | int flags, const char *dev_name, |
| 55 | - void *data, struct vfsmount *mnt) |
| 56 | -{ |
| 57 | - |
| 58 | - return get_sb_bdev(fs, flags, dev_name, data, |
| 59 | - yaffs_internal_read_super_mtd, mnt); |
| 60 | -} |
| 61 | -#else |
| 62 | -static struct super_block *yaffs_read_super(struct file_system_type *fs, |
| 63 | - int flags, const char *dev_name, |
| 64 | - void *data) |
| 65 | + void *data) |
| 66 | { |
| 67 | |
| 68 | - return get_sb_bdev(fs, flags, dev_name, data, |
| 69 | + return mount_bdev(fs, flags, dev_name, data, |
| 70 | yaffs_internal_read_super_mtd); |
| 71 | } |
| 72 | -#endif |
| 73 | |
| 74 | static struct file_system_type yaffs_fs_type = { |
| 75 | .owner = THIS_MODULE, |
| 76 | .name = "yaffs", |
| 77 | - .get_sb = yaffs_read_super, |
| 78 | + .mount = yaffs_read_super, |
| 79 | .kill_sb = kill_block_super, |
| 80 | .fs_flags = FS_REQUIRES_DEV, |
| 81 | }; |
| 82 | -#else |
| 83 | -static struct super_block *yaffs_read_super(struct super_block *sb, void *data, |
| 84 | - int silent) |
| 85 | -{ |
| 86 | - return yaffs_internal_read_super(1, sb, data, silent); |
| 87 | -} |
| 88 | - |
| 89 | -static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super, |
| 90 | - FS_REQUIRES_DEV); |
| 91 | -#endif |
| 92 | - |
| 93 | |
| 94 | #ifdef CONFIG_YAFFS_YAFFS2 |
| 95 | |
| 96 | -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) |
| 97 | static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, |
| 98 | int silent) |
| 99 | { |
| 100 | return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL; |
| 101 | } |
| 102 | |
| 103 | -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) |
| 104 | -static int yaffs2_read_super(struct file_system_type *fs, |
| 105 | - int flags, const char *dev_name, void *data, |
| 106 | - struct vfsmount *mnt) |
| 107 | +static struct dentry *yaffs2_read_super(struct file_system_type *fs, |
| 108 | + int flags, const char *dev_name, |
| 109 | + void *data) |
| 110 | { |
| 111 | - return get_sb_bdev(fs, flags, dev_name, data, |
| 112 | - yaffs2_internal_read_super_mtd, mnt); |
| 113 | + return mount_bdev(fs, flags, dev_name, data, |
| 114 | + yaffs_internal_read_super_mtd); |
| 115 | } |
| 116 | -#else |
| 117 | -static struct super_block *yaffs2_read_super(struct file_system_type *fs, |
| 118 | - int flags, const char *dev_name, |
| 119 | - void *data) |
| 120 | -{ |
| 121 | - |
| 122 | - return get_sb_bdev(fs, flags, dev_name, data, |
| 123 | - yaffs2_internal_read_super_mtd); |
| 124 | -} |
| 125 | -#endif |
| 126 | |
| 127 | static struct file_system_type yaffs2_fs_type = { |
| 128 | .owner = THIS_MODULE, |
| 129 | .name = "yaffs2", |
| 130 | - .get_sb = yaffs2_read_super, |
| 131 | + .mount = yaffs2_read_super, |
| 132 | .kill_sb = kill_block_super, |
| 133 | .fs_flags = FS_REQUIRES_DEV, |
| 134 | }; |
| 135 | -#else |
| 136 | -static struct super_block *yaffs2_read_super(struct super_block *sb, |
| 137 | - void *data, int silent) |
| 138 | -{ |
| 139 | - return yaffs_internal_read_super(2, sb, data, silent); |
| 140 | -} |
| 141 | - |
| 142 | -static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super, |
| 143 | - FS_REQUIRES_DEV); |
| 144 | -#endif |
| 145 | |
| 146 | #endif /* CONFIG_YAFFS_YAFFS2 */ |
| 147 | |
| 148 | |