Fix kernel compilation probs
[yaffs2.git] / yaffs_fs.c
index 873de3e698d2fe059d1a3f2e40127ec02dafee81..f97455b00a71453ca5c654f5c5565fab10f6a2b3 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 const char *yaffs_fs_c_version =
-    "$Id: yaffs_fs.c,v 1.32 2005-10-27 07:22:49 marty Exp $";
+    "$Id: yaffs_fs.c,v 1.35 2005-12-07 22:19:26 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 #include <linux/config.h>
@@ -152,7 +152,11 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
 
 static int yaffs_readlink(struct dentry *dentry, char __user * buffer,
                          int buflen);
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
+static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd);
+#else
 static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd);
+#endif
 
 static struct address_space_operations yaffs_file_address_operations = {
        .readpage = yaffs_readpage,
@@ -243,7 +247,11 @@ static int yaffs_readlink(struct dentry *dentry, char __user * buffer,
        return ret;
 }
 
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
+static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd)
+#else
 static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd)
+#endif
 {
        unsigned char *alias;
        int ret;
@@ -256,11 +264,19 @@ static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd)
        yaffs_GrossUnlock(dev);
 
        if (!alias)
-               return -ENOMEM;
+        {
+               ret = -ENOMEM;
+               goto out;
+        }
 
        ret = vfs_follow_link(nd, alias);
        kfree(alias);
+out:
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
+       return ERR_PTR (ret);
+#else
        return ret;
+#endif
 }
 
 struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev,
@@ -398,6 +414,9 @@ static void yaffs_delete_inode(struct inode *inode)
                yaffs_DeleteFile(obj);
                yaffs_GrossUnlock(dev);
        }
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
+        truncate_inode_pages (&inode->i_data, 0);
+#endif
        clear_inode(inode);
 }
 
@@ -1446,6 +1465,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
        dev->useNANDECC = 1;
 #endif
 
+#ifdef CONFIG_YAFFS_DISABLE_WIDE_TNODES
+       dev->wideTnodesDisabled = 1;
+#endif
+
        /* we assume this is protected by lock_kernel() in mount/umount */
        list_add_tail(&dev->devList, &yaffs_dev_list);
 
@@ -1493,7 +1516,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
 static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data,
                                         int silent)
 {
-       return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -1;
+       return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
 }
 
 static struct super_block *yaffs_read_super(struct file_system_type *fs,
@@ -1530,7 +1553,7 @@ static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super,
 static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
                                          int silent)
 {
-       return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -1;
+       return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
 }
 
 static struct super_block *yaffs2_read_super(struct file_system_type *fs,