Re:Raspberry Pi microSD card performance comparison
by amag on Saturday April 07, 2018 @03:26PM
(#16782340)
Haha, I spent so much time debugging their crappy FAT-driver. Another time the whole system would just hang when you created a new file in a directory that already contained some files. Turns out that their long-to-short filename algo was:
For the first 4 files with identical prefix use the ~N scheme as in LongFile.txt -> LONGFI~1.TXT
For the following files it was:
1) "LONG" + hex_str(hash(long_file_name)) + ".TXT"
2) if there's a name collision repeat step 1.
Compound that with a the fact that hash() was implemented something like:
int h = 0;
for(int i = 0; i < strlen(long_file_name); ++i)
{
h = (h + long_file_name[i]) ^ 0x42424242;
}
For the first 4 files with identical prefix use the ~N scheme as in LongFile.txt -> LONGFI~1.TXT For the following files it was: 1) "LONG" + hex_str(hash(long_file_name)) + ".TXT" 2) if there's a name collision repeat step 1.
Compound that with a the fact that hash() was implemented something like:
It's pretty easy to see where this falls apart...