kdev_t usage fix for reiser4
Hi!
I got reiser4 working with the 64 bit kdev_t patch.
You are not allowed to use kdev_val except for hashing purposes. Also the kdev_t should not be used outside the kernel. That's what dev_t is for.
I've attached a patch that fixes the usage in a bunch of places.
But I would also vote to use dev_t instead of int for reiser4 memory structures that hold device numbers and reserve 64 bits for it in the filesystem.
There is a place where the dev_t is used for debugging output, you should also replace it to use the print_dev_t function (it returns a string) because you don't know it's size for the printf format.
--
Christophe Saout <[email protected]>
Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html
fs/reiser4/inode.c +2 -2
@@ -170,11 +170,11 @@case S_IFBLK :case S_IFCHR :case S_IFIFO :{ -int rdev;/* to keep gcc happy */ +dev_t rdev;/* ugly hack with rdev */ if (data ==NULL ) { - rdev =kdev_val (inode->i_rdev); + rdev =kdev_t_to_nr (inode->i_rdev); inode->i_rdev =val_to_kdev (0 ); }else rdev = data->rdev;
fs/reiser4/plugin/item/static_stat.c +2 -2
@@ -425,7 +425,7 @@ inode->i_atime.tv_sec =d32tocpu (&sd->atime); inode->i_mtime.tv_sec =d32tocpu (&sd->mtime); inode->i_ctime.tv_sec =d32tocpu (&sd->ctime); - inode->i_rdev =val_to_kdev (d32tocpu (&sd->rdev)); + inode->i_rdev =to_kdev_t (d32tocpu (&sd->rdev));inode_set_bytes (inode, (loff_t )d64tocpu (&sd->bytes));next_stat (len, area,sizeof *sd);return 0 ;
@@ -470,7 +470,7 @@cputod32 ((__u32 ) inode->i_atime.tv_sec, &sd->atime);cputod32 ((__u32 ) inode->i_ctime.tv_sec, &sd->ctime);cputod32 ((__u32 ) inode->i_mtime.tv_sec, &sd->mtime); -cputod32 (kdev_val (inode->i_rdev), &sd->rdev); +cputod32 (kdev_t_to_nr (inode->i_rdev), &sd->rdev);cputod64 ((__u64 )inode_get_bytes (inode), &sd->bytes); *area +=sizeof *sd;return 0 ;