From: Adrian M. <zx8...@us...> - 2002-11-13 23:19:44
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv27738/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch super.c Log Message: Fix to file mode code Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -d -r1.1.2.12 -r1.1.2.13 --- super.c 10 Nov 2002 00:52:00 -0000 1.1.2.12 +++ super.c 13 Nov 2002 23:19:41 -0000 1.1.2.13 @@ -114,8 +114,9 @@ blck_read--; bh = bread(sb->s_dev, blck_read, 512); } - if (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + - 0x01] == in->i_ino) + if (le16_to_cpu + (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x01]) == in->i_ino) break; } @@ -126,34 +127,32 @@ } /* identified the correct directory entry */ - century = - int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); - year = - int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); - month = - int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); + century = int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); + year = int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); + month = int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); day = int_from_bcd((bh->b_data)[0x13 + (y % 0x10) * 0x20]); - hour = - int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); - minute = - int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); - second = - int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); + hour = int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); + minute = int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); + second = int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); in->i_ctime = in->i_mtime = mktime(century * 100 + year, month, day, hour, minute, second); + in->i_mode &= ~(S_IWUGO | S_IXUGO); /* Execute if a game, write if not copy protected */ in->i_mode |= S_IRUGO; + /* Mode - is the file copiable? */ - if (((__u8 *) bh->b_data)[0x01 + (y % 0x10) * 0x20] == - 0x00) + if ((((__u8 *) bh->b_data)[0x01 + (y % 0x10) * 0x20] == + 0x00) & ~(sb->s_flags & MS_RDONLY)) in->i_mode |= S_IWUGO; /* Is file executible - ie a game */ - if (((__u8 *) bh->b_data)[(y % 0x10) * 0x20] == 0xcc) + if ((((__u8 *) bh->b_data)[(y % 0x10) * 0x20] == + 0xcc) & ~(sb->s_flags & MS_NOEXEC)) in->i_mode |= S_IXUGO; + in->i_uid = in->i_gid = 0; in->i_op = &vmufs_file_inode_operations; @@ -172,7 +171,8 @@ void vmufs_put_super(struct super_block *sb) { sb->s_dev = 0; - struct memcard *vmudetails = (struct memcard *) (sb->u.generic_sbp); + struct memcard *vmudetails = + (struct memcard *) (sb->u.generic_sbp); kfree(vmudetails); } @@ -218,13 +218,11 @@ /*Search for the superblock - assuming likely sizes are 256, 128, 512 and 1024 blocks */ - struct buffer_head *bh; + struct buffer_head *bh = NULL; int z; /* Have to try lowest number first to avoid oops */ for (z = 128; z < 1024; z = z * 2) { - bh = bread(sb->s_dev, z - 1, 512); - if (check_sb_format(bh)) break; brelse(bh); @@ -300,6 +298,7 @@ module_init(init_vmufs_fs) module_exit(exit_vmufs_fs) - MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); + +MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); MODULE_AUTHOR("Adrian McMenamin"); MODULE_LICENSE("GPL"); |