From: Adrian M. <zx8...@us...> - 2002-11-08 19:41:29
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv21941/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch super.c inode.c Log Message: Tidy of vmufs code Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -d -r1.1.2.10 -r1.1.2.11 --- super.c 6 Nov 2002 23:59:06 -0000 1.1.2.10 +++ super.c 8 Nov 2002 19:41:26 -0000 1.1.2.11 @@ -54,12 +54,12 @@ struct buffer_head *bh = sb_bread(sb, in->i_ino); century = int_from_bcd((bh->b_data)[0x30]); - year = int_from_bcd((bh->b_data)[0x31]); - month = int_from_bcd((bh->b_data)[0x32]); - day = int_from_bcd((bh->b_data)[0x33]); - hour = int_from_bcd((bh->b_data)[0x34]); - minute = int_from_bcd((bh->b_data)[0x35]); - second = int_from_bcd((bh->b_data)[0x36]); + year = int_from_bcd((bh->b_data)[0x31]); + month = int_from_bcd((bh->b_data)[0x32]); + day = int_from_bcd((bh->b_data)[0x33]); + hour = int_from_bcd((bh->b_data)[0x34]); + minute = int_from_bcd((bh->b_data)[0x35]); + second = int_from_bcd((bh->b_data)[0x36]); /* * As a temporary workaround, clear out any @@ -85,7 +85,7 @@ in->i_version = ++event; brelse(bh); } else { - int blck_read = 253; + int blck_read = 253; struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); int y; @@ -106,13 +106,13 @@ /* Scan through the directory to find the matching file */ for (y = 0; y < 200; y++) { - if ((y / 0x10) > (253 - blck_read)){ - brelse(bh); - blck_read--; - bh = bread(sb->s_dev, blck_read, 512); - } - if (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + 0x01] == - in->i_ino) + if ((y / 0x10) > (253 - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); + } + if (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x01] == in->i_ino) break; } @@ -123,13 +123,19 @@ } /* 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]); - 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]); + 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]); in->i_ctime = in->i_mtime = mktime(century * 100 + year, month, day, hour, minute, @@ -138,7 +144,8 @@ 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) in->i_mode |= S_IWUGO; /* Is file executible - ie a game */ if (((__u8 *) bh->b_data)[(y % 0x10) * 0x20] == 0xcc) @@ -150,7 +157,8 @@ in->i_fop = &vmufs_file_operations; in->i_blocks = - le16_to_cpu(((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + 0x0C]); + le16_to_cpu(((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x0C]); in->i_size = in->i_blocks * 512; in->i_blksize = 512; @@ -166,15 +174,16 @@ static int vmufs_statfs(struct super_block *sb, struct statfs *buf) { struct mtd_info *mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - struct maple_driver_data *d = (struct maple_driver_data *)(mtd->priv); - memcard_t *memcard = (memcard_t *)(d->private_data); + struct maple_driver_data *d = + (struct maple_driver_data *) (mtd->priv); + memcard_t *memcard = (memcard_t *) (d->private_data); - buf->f_type = 0x55555555; - buf->f_bsize = mtd->erasesize; - buf->f_bfree = memcard->numblocks; - buf->f_bavail = 0; - buf->f_ffree = 0; - buf->f_namelen = 12; + buf->f_type = 0x55555555; + buf->f_bsize = mtd->erasesize; + buf->f_bfree = memcard->numblocks; + buf->f_bavail = 0; + buf->f_ffree = 0; + buf->f_namelen = 12; put_mtd_device(mtd); @@ -182,25 +191,27 @@ } static struct super_operations vmufs_super_operations = { - read_inode: vmufs_read_inode, - put_super: vmufs_put_super, - statfs: vmufs_statfs, + read_inode: vmufs_read_inode, + put_super: vmufs_put_super, + statfs: vmufs_statfs, }; static struct super_block *vmufs_read_super(struct super_block *sb, void *data, int silent) { struct mtd_info *mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - struct maple_driver_data *d = (struct maple_driver_data *)(mtd->priv); - memcard_t *memcard = (memcard_t *)(d->private_data); + struct maple_driver_data *d = + (struct maple_driver_data *) (mtd->priv); + memcard_t *memcard = (memcard_t *) (d->private_data); struct buffer_head *bh; struct inode *root_i; int erasesize, log_2 = 0; /* Read off the details of this device */ if (MAJOR(sb->s_dev) != MTD_BLOCK_MAJOR) { - printk(KERN_ERR "vmufs: attempt to mount non-MTD device %s\n " - "as vmu filesystem", kdevname(sb->s_dev)); + printk(KERN_ERR + "vmufs: attempt to mount non-MTD device %s\n " + "as vmu filesystem", kdevname(sb->s_dev)); return NULL; } @@ -223,7 +234,8 @@ && (((__u32 *) bh->b_data)[1] == sb->s_magic) && (((__u32 *) bh->b_data)[2] == sb->s_magic) && (sb->s_magic == ((__u32 *) bh->b_data)[3]))) { - printk("Attempted to mount non-vmufs filesystem as vmufs\n"); + printk + ("Attempted to mount non-vmufs filesystem as vmufs\n"); brelse(bh); return NULL; } @@ -263,4 +275,3 @@ MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); MODULE_AUTHOR("Adrian McMenamin"); MODULE_LICENSE("GPL"); - Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.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 --- inode.c 6 Nov 2002 23:59:06 -0000 1.1.2.12 +++ inode.c 8 Nov 2002 19:41:26 -0000 1.1.2.13 @@ -47,15 +47,17 @@ last_one = saved_file; saved_file->copy_pro = ((__u8 *) bh->b_data)[1 + (fno % 0x10) * 0x20]; - saved_file->fblk = ((__u16 *) bh->b_data)[1 + (fno % 0x10) * 0x10]; - memcpy(saved_file->fname, bh->b_data + 4 + (fno % 0x10) * 0x20, 12); + saved_file->fblk = + ((__u16 *) bh->b_data)[1 + (fno % 0x10) * 0x10]; + memcpy(saved_file->fname, + bh->b_data + 4 + (fno % 0x10) * 0x20, 12); fno++; - if ((fno/0x10)> (253 - blck_read)){ - brelse(bh); - blck_read--; - bh = bread(sb->s_dev, blck_read, 512); + if ((fno / 0x10) > (253 - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); } } while (1); @@ -179,10 +181,10 @@ } struct file_operations vmufs_file_dir_operations = { - owner:THIS_MODULE, - read:generic_read_dir, - readdir:vmufs_readdir, - fsync:file_fsync, + owner: THIS_MODULE, + read: generic_read_dir, + readdir: vmufs_readdir, + fsync: file_fsync, }; ssize_t vmufs_file_read(struct file *file, char *buf, size_t count, @@ -240,7 +242,7 @@ } struct file_operations vmufs_file_operations = { - read:vmufs_file_read, + read: vmufs_file_read, }; struct inode_operations vmufs_file_inode_operations = { |