[Yaffs] yaffs patch-ker.sh doesn't work with Linux 3.0-rc1. …

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffs-mount.patch (text/x-patch)
Delete this message
Reply to this message
Author: Nick Bane
Date:  
To: yaffs
Old-Topics: [Yaffs] mkyaffs2image desn't work with Linux 2.6.23
Subject: [Yaffs] yaffs patch-ker.sh doesn't work with Linux 3.0-rc1. get_sb field removed from file_system_type in 2.6.39
Charles

The test for 2.6.x in patch-ker.sh fails with kernels 3 and up.

A fix is trivial but as I am not profficient with git and am discouraged
from fixing it directly.

Also, 2.6.39 has removed the .get_sb field and only supports the .mount
field in file_system_type struct. I attach a non-git patch that seems to
work ok. It tests for kernel version >= 2.6.39 but as this probably applies
to previous kernels it may be better to #define USE_MOUNT_FIELD conditional
of some previous kernel threshold and use that instead.

Nick Bane
Index: linux-3.0-rc1/fs/yaffs2/yaffs_vfs.c
===================================================================
--- linux-3.0-rc1.orig/fs/yaffs2/yaffs_vfs.c    2011-05-31 20:43:52.000000000 +0100
+++ linux-3.0-rc1/fs/yaffs2/yaffs_vfs.c    2011-05-31 13:58:42.000000000 +0100
@@ -72,7 +72,9 @@
 #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>
+#endif
 #include <linux/pagemap.h>
 #include <linux/mtd/mtd.h>
 #include <linux/interrupt.h>
@@ -2973,7 +2975,13 @@
     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)
@@ -2996,7 +3004,11 @@
 static struct file_system_type yaffs_fs_type = {
     .owner = THIS_MODULE,
     .name = "yaffs",
+#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,
 };
@@ -3019,7 +3031,13 @@
     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)
@@ -3038,10 +3056,15 @@
 }
 #endif


+
 static struct file_system_type yaffs2_fs_type = {
     .owner = THIS_MODULE,
     .name = "yaffs2",
+#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,
 };