summaryrefslogtreecommitdiffstats
path: root/fs/fat
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2005-10-30 15:03:49 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 17:37:32 -0800
commit451cbaa1c328082832a8fbcc427cd4416c602c5a (patch)
tree139c3d33d0cf3f9eba214c504e4173f54c6cf66d /fs/fat
parent4e57b6817880946a3a78d5d8cad1ace363f7e449 (diff)
downloadop-kernel-dev-451cbaa1c328082832a8fbcc427cd4416c602c5a.zip
op-kernel-dev-451cbaa1c328082832a8fbcc427cd4416c602c5a.tar.gz
[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 'fs/fat')
-rw-r--r--fs/fat/dir.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 895049b..204d861 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -263,7 +263,6 @@ parse_record:
unsigned char id;
unsigned char slot;
unsigned char slots;
- unsigned char sum;
unsigned char alias_checksum;
if (!unicode) {
@@ -317,9 +316,7 @@ parse_long:
goto parse_long;
if (IS_FREE(de->name) || (de->attr & ATTR_VOLUME))
continue;
- for (sum = 0, i = 0; i < 11; i++)
- sum = (((sum&1)<<7)|((sum&0xfe)>>1)) + de->name[i];
- if (sum != alias_checksum)
+ if (fat_checksum(de->name) != alias_checksum)
nr_slots = 0;
}
@@ -479,7 +476,6 @@ GetNew:
unsigned char id;
unsigned char slot;
unsigned char slots;
- unsigned char sum;
unsigned char alias_checksum;
if (!unicode) {
@@ -534,9 +530,7 @@ ParseLong:
goto ParseLong;
if (IS_FREE(de->name) || (de->attr & ATTR_VOLUME))
goto RecEnd;
- for (sum = 0, i = 0; i < 11; i++)
- sum = (((sum&1)<<7)|((sum&0xfe)>>1)) + de->name[i];
- if (sum != alias_checksum)
+ if (fat_checksum(de->name) != alias_checksum)
long_slots = 0;
}
OpenPOWER on IntegriCloud