yaffs Sort out some Linux multi-version compilation issues
authorCharles Manning <cdhmanning@gmail.com>
Tue, 21 Sep 2010 01:44:16 +0000 (13:44 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Tue, 21 Sep 2010 01:44:16 +0000 (13:44 +1200)
Fix problems where some versions were not compiling.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_fs.c

index ecf2bbe4d48bc458fff4396e663b8b1bc8a3e781..dc00bd5abc8ef12ffd6e76b705c858b6a41afeaa 100644 (file)
@@ -35,6 +35,9 @@
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10))
 #define YAFFS_COMPILE_BACKGROUND
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10))
 #define YAFFS_COMPILE_BACKGROUND
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6, 23))
+#define YAFFS_COMPILE_FREEZER
+#endif
 #endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
 #endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
@@ -83,6 +86,8 @@
 #ifdef YAFFS_COMPILE_BACKGROUND
 #include <linux/kthread.h>
 #include <linux/delay.h>
 #ifdef YAFFS_COMPILE_BACKGROUND
 #include <linux/kthread.h>
 #include <linux/delay.h>
+#endif
+#ifdef YAFFS_COMPILE_FREEZER
 #include <linux/freezer.h>
 #endif
 
 #include <linux/freezer.h>
 #endif
 
@@ -492,7 +497,8 @@ static  int yaffs_vfs_setsize(struct inode *inode, loff_t newsize)
        truncate_setsize(inode,newsize);
        return 0;
 #else
        truncate_setsize(inode,newsize);
        return 0;
 #else
-       return simple_setsize(inode, newsize);
+       truncate_inode_pages(&inode->i_data,newsize);
+       return 0;
 #endif
 
 }
 #endif
 
 }
@@ -2319,8 +2325,9 @@ static int yaffs_BackgroundThread(void *data)
                (TSTR("yaffs_background starting for dev %p\n"),
                (void *)dev));
 
                (TSTR("yaffs_background starting for dev %p\n"),
                (void *)dev));
 
+#ifdef YAFFS_COMPILE_FREEZER
        set_freezable();
        set_freezable();
-
+#endif
        while(context->bgRunning){
                T(YAFFS_TRACE_BACKGROUND,
                        (TSTR("yaffs_background\n")));
        while(context->bgRunning){
                T(YAFFS_TRACE_BACKGROUND,
                        (TSTR("yaffs_background\n")));
@@ -2328,9 +2335,10 @@ static int yaffs_BackgroundThread(void *data)
                if(kthread_should_stop())
                        break;
 
                if(kthread_should_stop())
                        break;
 
+#ifdef YAFFS_COMPILE_FREEZER
                if(try_to_freeze())
                        continue;
                if(try_to_freeze())
                        continue;
-
+#endif
                yaffs_GrossLock(dev);
 
                now = jiffies;
                yaffs_GrossLock(dev);
 
                now = jiffies;