Mods for Linux 3.0 and fix a typo
[yaffs2.git] / yaffs_vfs_multi.c
index 966df484835990673eb43167ea4b4338113512ad..b8e51243051a27fc7a17c3b79dbbfd72555699b1 100644 (file)
@@ -72,7 +72,9 @@
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
 #include <linux/smp_lock.h>
 #include <linux/smp_lock.h>
+#endif
 #include <linux/pagemap.h>
 #include <linux/mtd/mtd.h>
 #include <linux/interrupt.h>
 #include <linux/pagemap.h>
 #include <linux/mtd/mtd.h>
 #include <linux/interrupt.h>
@@ -237,7 +239,9 @@ static int yaffs_file_flush(struct file *file, fl_owner_t id);
 static int yaffs_file_flush(struct file *file);
 #endif
 
 static int yaffs_file_flush(struct file *file);
 #endif
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync);
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
 static int yaffs_sync_object(struct file *file, int datasync);
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
 static int yaffs_sync_object(struct file *file, int datasync);
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
@@ -1826,7 +1830,9 @@ static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
        return -ENOMEM;
 }
 
        return -ENOMEM;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync)
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
 static int yaffs_sync_object(struct file *file, int datasync)
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
 static int yaffs_sync_object(struct file *file, int datasync)
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
@@ -2973,7 +2979,13 @@ static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data,
        return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
 }
 
        return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static struct dentry *yaffs_mount(struct file_system_type *fs_type, int flags,
+        const char *dev_name, void *data)
+{
+    return mount_bdev(fs_type, flags, dev_name, data, yaffs_internal_read_super_mtd);
+}
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
 static int yaffs_read_super(struct file_system_type *fs,
                            int flags, const char *dev_name,
                            void *data, struct vfsmount *mnt)
 static int yaffs_read_super(struct file_system_type *fs,
                            int flags, const char *dev_name,
                            void *data, struct vfsmount *mnt)
@@ -2996,8 +3008,12 @@ static struct super_block *yaffs_read_super(struct file_system_type *fs,
 static struct file_system_type yaffs_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs",
 static struct file_system_type yaffs_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs",
-       .get_sb = yaffs_read_super,
-       .kill_sb = kill_block_super,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+        .mount = yaffs_mount,
+#else
+        .get_sb = yaffs_read_super,
+#endif
+       .kill_sb = kill_block_super,
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
@@ -3019,7 +3035,13 @@ static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
        return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
 }
 
        return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static struct dentry *yaffs2_mount(struct file_system_type *fs_type, int flags,
+        const char *dev_name, void *data)
+{
+        return mount_bdev(fs_type, flags, dev_name, data, yaffs2_internal_read_super_mtd);
+}
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
 static int yaffs2_read_super(struct file_system_type *fs,
                             int flags, const char *dev_name, void *data,
                             struct vfsmount *mnt)
 static int yaffs2_read_super(struct file_system_type *fs,
                             int flags, const char *dev_name, void *data,
                             struct vfsmount *mnt)
@@ -3041,8 +3063,12 @@ static struct super_block *yaffs2_read_super(struct file_system_type *fs,
 static struct file_system_type yaffs2_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs2",
 static struct file_system_type yaffs2_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs2",
-       .get_sb = yaffs2_read_super,
-       .kill_sb = kill_block_super,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+        .mount = yaffs2_mount,
+#else
+        .get_sb = yaffs2_read_super,
+#endif
+       .kill_sb = kill_block_super,
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
@@ -3112,8 +3138,8 @@ static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev *dev)
                                dev->oldest_dirty_gc_count);
        buf += sprintf(buf, "n_gc_blocks.......... %u\n", dev->n_gc_blocks);
        buf += sprintf(buf, "bg_gcs............... %u\n", dev->bg_gcs);
                                dev->oldest_dirty_gc_count);
        buf += sprintf(buf, "n_gc_blocks.......... %u\n", dev->n_gc_blocks);
        buf += sprintf(buf, "bg_gcs............... %u\n", dev->bg_gcs);
-       buf += sprintf(buf, "n_retired_writes..... %u\n",
-                               dev->n_retired_writes);
+       buf += sprintf(buf, "n_retried_writes..... %u\n",
+                               dev->n_retried_writes);
        buf += sprintf(buf, "n_retired_blocks..... %u\n",
                                dev->n_retired_blocks);
        buf += sprintf(buf, "n_ecc_fixed.......... %u\n", dev->n_ecc_fixed);
        buf += sprintf(buf, "n_retired_blocks..... %u\n",
                                dev->n_retired_blocks);
        buf += sprintf(buf, "n_ecc_fixed.......... %u\n", dev->n_ecc_fixed);