diff options
Diffstat (limited to 'include/linux/msdos_fs.h')
-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) | |||
282 | MSDOS_I(inode)->i_attrs; | 282 | MSDOS_I(inode)->i_attrs; |
283 | } | 283 | } |
284 | 284 | ||
285 | static inline unsigned char fat_checksum(const __u8 *name) | ||
286 | { | ||
287 | unsigned char s = name[0]; | ||
288 | s = (s<<7) + (s>>1) + name[1]; s = (s<<7) + (s>>1) + name[2]; | ||
289 | s = (s<<7) + (s>>1) + name[3]; s = (s<<7) + (s>>1) + name[4]; | ||
290 | s = (s<<7) + (s>>1) + name[5]; s = (s<<7) + (s>>1) + name[6]; | ||
291 | s = (s<<7) + (s>>1) + name[7]; s = (s<<7) + (s>>1) + name[8]; | ||
292 | s = (s<<7) + (s>>1) + name[9]; s = (s<<7) + (s>>1) + name[10]; | ||
293 | return s; | ||
294 | } | ||
295 | |||
285 | static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) | 296 | static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) |
286 | { | 297 | { |
287 | return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus | 298 | return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus |