diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2005-10-30 18:03:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:32 -0500 |
commit | 451cbaa1c328082832a8fbcc427cd4416c602c5a (patch) | |
tree | 139c3d33d0cf3f9eba214c504e4173f54c6cf66d /fs | |
parent | 4e57b6817880946a3a78d5d8cad1ace363f7e449 (diff) |
[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')
-rw-r--r-- | fs/fat/dir.c | 10 | ||||
-rw-r--r-- | fs/vfat/namei.c | 3 |
2 files changed, 3 insertions, 10 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 895049b2ac9c..204d8614406f 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -263,7 +263,6 @@ parse_record: | |||
263 | unsigned char id; | 263 | unsigned char id; |
264 | unsigned char slot; | 264 | unsigned char slot; |
265 | unsigned char slots; | 265 | unsigned char slots; |
266 | unsigned char sum; | ||
267 | unsigned char alias_checksum; | 266 | unsigned char alias_checksum; |
268 | 267 | ||
269 | if (!unicode) { | 268 | if (!unicode) { |
@@ -317,9 +316,7 @@ parse_long: | |||
317 | goto parse_long; | 316 | goto parse_long; |
318 | if (IS_FREE(de->name) || (de->attr & ATTR_VOLUME)) | 317 | if (IS_FREE(de->name) || (de->attr & ATTR_VOLUME)) |
319 | continue; | 318 | continue; |
320 | for (sum = 0, i = 0; i < 11; i++) | 319 | if (fat_checksum(de->name) != alias_checksum) |
321 | sum = (((sum&1)<<7)|((sum&0xfe)>>1)) + de->name[i]; | ||
322 | if (sum != alias_checksum) | ||
323 | nr_slots = 0; | 320 | nr_slots = 0; |
324 | } | 321 | } |
325 | 322 | ||
@@ -479,7 +476,6 @@ GetNew: | |||
479 | unsigned char id; | 476 | unsigned char id; |
480 | unsigned char slot; | 477 | unsigned char slot; |
481 | unsigned char slots; | 478 | unsigned char slots; |
482 | unsigned char sum; | ||
483 | unsigned char alias_checksum; | 479 | unsigned char alias_checksum; |
484 | 480 | ||
485 | if (!unicode) { | 481 | if (!unicode) { |
@@ -534,9 +530,7 @@ ParseLong: | |||
534 | goto ParseLong; | 530 | goto ParseLong; |
535 | if (IS_FREE(de->name) || (de->attr & ATTR_VOLUME)) | 531 | if (IS_FREE(de->name) || (de->attr & ATTR_VOLUME)) |
536 | goto RecEnd; | 532 | goto RecEnd; |
537 | for (sum = 0, i = 0; i < 11; i++) | 533 | if (fat_checksum(de->name) != alias_checksum) |
538 | sum = (((sum&1)<<7)|((sum&0xfe)>>1)) + de->name[i]; | ||
539 | if (sum != alias_checksum) | ||
540 | long_slots = 0; | 534 | long_slots = 0; |
541 | } | 535 | } |
542 | 536 | ||
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c index 1c6f6b57ef1c..467346b123d9 100644 --- a/fs/vfat/namei.c +++ b/fs/vfat/namei.c | |||
@@ -621,8 +621,7 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, | |||
621 | } | 621 | } |
622 | 622 | ||
623 | /* build the entry of long file name */ | 623 | /* build the entry of long file name */ |
624 | for (cksum = i = 0; i < 11; i++) | 624 | cksum = fat_checksum(msdos_name); |
625 | cksum = (((cksum&1)<<7)|((cksum&0xfe)>>1)) + msdos_name[i]; | ||
626 | 625 | ||
627 | *nr_slots = usize / 13; | 626 | *nr_slots = usize / 13; |
628 | for (ps = slots, i = *nr_slots; i > 0; i--, ps++) { | 627 | for (ps = slots, i = *nr_slots; i > 0; i--, ps++) { |