[Yaffs] Patch for special devices

Luc Van Oostenryck luc.vanoostenryck@easynet.be
Mon, 07 Feb 2005 00:28:53 +0100


Charles Manning wrote:
> Thanx for the patch.
> 
> I don't have a 2.6 test system set up at present.
> 
> Can someone verify this/comment?
> 
> Thanx
> 
> -- CHarles

Yes, it is correct, coherent with the beginning of the function.
A simpler patch should be (reuse the value already set above in the function;
not tested, because I can't test here, will do it tomorow):
diff -u -r1.37 yaffs_fs.c
--- yaffs_fs.c  6 Jan 2005 23:28:34 -0000       1.37
+++ yaffs_fs.c  6 Feb 2005 23:17:38 -0000
@@ -640,7 +640,7 @@
                 switch (obj->st_mode & S_IFMT)
                 {
                         default: // fifo, device or socket
-                               init_special_inode(inode, obj->st_mode,(dev_t)(obj->st_rdev));
+                               init_special_inode(inode, obj->st_mode, inode->i_rdev);
                                 break;
                         case S_IFREG:   // file
                                 inode->i_op = &yaffs_file_inode_operations;


BTW, the code using old_decode_dev(), i.e.:
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))

                 inode->i_rdev = old_decode_dev(obj->st_rdev);

is only needed to keep the compability between Linux 2.4 (16 bits dev_t) and 2.6 (32 bits dev_t).
Since yaffs' st_rdev is 32 bits, for a new system using Linux 2.6, old_decode_dev() is not needed.
Maybe we should have one more option: CONFIG_YAFFS_2_4_COMPABILITY?


Luc Van Oostenryck