[Yaffs] [PATCH] Fixed up some API change in 2.6.19 when merg…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bryan Wu
Date:  
To: yaffs
Subject: [Yaffs] [PATCH] Fixed up some API change in 2.6.19 when merging YAFFS2
Hi alls:

I am a user of YAFFS2 in our project blackfin-uclinux
(blackfin.uclinux.org). When merging the YAFFS2 latest CVS root.tar.gz
patches to the 2.6.19 kernel, I found errors due to some kernel API
changes:
================================================================
CC [M] fs/yaffs2/yaffs_fs.o
fs/yaffs2/yaffs_fs.c:192: error: 'generic_file_read' undeclared here
(not in a function)
fs/yaffs2/yaffs_fs.c:193: error: 'generic_file_write' undeclared here
(not in a function)
fs/yaffs2/yaffs_fs.c: In function 'yaffs_readlink':
fs/yaffs2/yaffs_fs.c:263: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:267: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_follow_link':
fs/yaffs2/yaffs_fs.c:287: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:291: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_lookup':
fs/yaffs2/yaffs_fs.c:328: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:332: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:337: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_clear_inode':
fs/yaffs2/yaffs_fs.c:396: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:411: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_delete_inode':
fs/yaffs2/yaffs_fs.c:432: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_file_flush':
fs/yaffs2/yaffs_fs.c:458: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_readpage_nolock':
fs/yaffs2/yaffs_fs.c:489: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_writepage':
fs/yaffs2/yaffs_fs.c:589: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_FillInodeFromObject':
fs/yaffs2/yaffs_fs.c:707: error: 'struct inode' has no member named 'i_blksize'
fs/yaffs2/yaffs_fs.c:759: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_file_write':
fs/yaffs2/yaffs_fs.c:808: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:826: warning: format '%d' expects type 'int', but
argument 2 has type 'size_t'
fs/yaffs2/yaffs_fs.c:835: warning: format '%d' expects type 'int', but
argument 2 has type 'size_t'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_readdir':
fs/yaffs2/yaffs_fs.c:868: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_mknod':
fs/yaffs2/yaffs_fs.c:962: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_unlink':
fs/yaffs2/yaffs_fs.c:1077: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1081: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_link':
fs/yaffs2/yaffs_fs.c:1107: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1115: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_symlink':
fs/yaffs2/yaffs_fs.c:1150: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1152: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_sync_object':
fs/yaffs2/yaffs_fs.c:1179: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_rename':
fs/yaffs2/yaffs_fs.c:1203: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1209: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1227: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1229: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_setattr':
fs/yaffs2/yaffs_fs.c:1254: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1260: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c:1262: error: 'struct inode' has no member named 'u'
fs/yaffs2/yaffs_fs.c: In function 'yaffs_statfs':
fs/yaffs2/yaffs_fs.c:1278: error: 'struct inode' has no member named 'u'
make[3]: *** [fs/yaffs2/yaffs_fs.o] Error 1
make[2]: *** [fs/yaffs2] Error 2
make[1]: *** [fs] Error 2
=============================================

So I submitted the patch to correct these errors:
fixed-API-changes-in-2.6.19.patch
=============================================
--- Development/yaffs2/yaffs_fs.c    2006-12-20 05:33:41.000000000 +0800
+++ linux-2.6/fs/yaffs2/yaffs_fs.c    2007-01-02 15:33:44.000000000 +0800
@@ -19,7 +19,7 @@
  *         this superblock
  * >> 2.6: sb->s_fs_info  points to the yaffs_Device associated with this
  *         superblock
- * >> inode->u.generic_ip points to the associated yaffs_Object.
+ * >> inode->i_private points to the associated yaffs_Object.
  *
  * Acknowledgements:
  * * Luc van OostenRyck for numerous patches.
@@ -89,7 +89,7 @@ unsigned yaffs_traceMask = YAFFS_TRACE_A


/*#define T(x) printk x */

-#define yaffs_InodeToObject(iptr) ((yaffs_Object *)((iptr)->u.generic_ip))
+#define yaffs_InodeToObject(iptr) ((yaffs_Object *)((iptr)->i_private))
#define yaffs_DentryToObject(dptr) yaffs_InodeToObject((dptr)->d_inode)

#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
@@ -189,8 +189,8 @@ static struct address_space_operations y
};

 static struct file_operations yaffs_file_operations = {
-    .read = generic_file_read,
-    .write = generic_file_write,
+    .read = do_sync_read,
+    .write = do_sync_write,
     .mmap = generic_file_mmap,
     .flush = yaffs_file_flush,
     .fsync = yaffs_sync_object,
@@ -408,7 +408,7 @@ static void yaffs_clear_inode(struct ino
          * the yaffs_Object.
          */
         obj->myInode = NULL;
-        inode->u.generic_ip = NULL;
+        inode->i_private = NULL;


         /* If the object freeing was deferred, then the real
          * free happens now.
@@ -704,7 +704,6 @@ static void yaffs_FillInodeFromObject(st
         inode->i_mode = obj->yst_mode;
         inode->i_uid = obj->yst_uid;
         inode->i_gid = obj->yst_gid;
-        inode->i_blksize = inode->i_sb->s_blocksize;
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))


         inode->i_rdev = old_decode_dev(obj->yst_rdev);
@@ -756,7 +755,7 @@ static void yaffs_FillInodeFromObject(st
             break;
         }


-        inode->u.generic_ip = obj;
+        inode->i_private = obj;
         obj->myInode = inode;


     } else {
==============================================