diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2005-10-31 00:03:49 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-31 02:37:32 +0100 |
commit | 451cbaa1c328082832a8fbcc427cd4416c602c5a (patch) | |
tree | 139c3d33d0cf3f9eba214c504e4173f54c6cf66d /include | |
parent | [PATCH] fix missing includes (diff) | |
download | linux-451cbaa1c328082832a8fbcc427cd4416c602c5a.tar.xz linux-451cbaa1c328082832a8fbcc427cd4416c602c5a.zip |
[PATCH] fat: cleanup and optimization of checksum
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/msdos_fs.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index 9a3d27257984..941da5c016a0 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -282,6 +282,17 @@ static inline u8 fat_attr(struct inode *inode) MSDOS_I(inode)->i_attrs; } +static inline unsigned char fat_checksum(const __u8 *name) +{ + unsigned char s = name[0]; + s = (s<<7) + (s>>1) + name[1]; s = (s<<7) + (s>>1) + name[2]; + s = (s<<7) + (s>>1) + name[3]; s = (s<<7) + (s>>1) + name[4]; + s = (s<<7) + (s>>1) + name[5]; s = (s<<7) + (s>>1) + name[6]; + s = (s<<7) + (s>>1) + name[7]; s = (s<<7) + (s>>1) + name[8]; + s = (s<<7) + (s>>1) + name[9]; s = (s<<7) + (s>>1) + name[10]; + return s; +} + static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) { return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus |