Long file name issue of FAT

Joel Sherrill joel.sherrill at oarcorp.com
Wed Dec 3 03:05:48 UTC 2014



On December 2, 2014 9:53:34 PM EST, erlking <ruizx at qq.com> wrote:
>Hello everyone,
>
>We'v found a long file name issue of FAT in our application.
>
>
>When create a long name file on SD card in rtems system, it can display
>the right long name.
>
>But if use the SD card in Windows, it just display the short name of
>the file, like "ABCDE1~4.TXT", :(
>
>
>I trace the code, the root cause of this issue is in msdos_add_file
>function, near line 1837.
>
>The unicode coding of long file name use the 0x0000 as the end flag,
>the memory content is unknown after the flag.
>
>
>When fill the long name in MSDOS_LFN_ENTRY, current code want to fill
>0xffff after the flag.
>
>But it not consider the memory content is unknown ‍after the end flag,
>continue copying the content. 
>
>------------------------------------------------------------
>
>for (i = 0; i < MSDOS_LFN_LEN_PER_ENTRY; ++i) { if (!(*n == 0 && *(n+1)
>== 0))//xxx, after the flag, the condition is no use, should fill
>0xffff. { *p = *n; *(p+1) = *(n+1); } else { p [0] = fill; p [1] =
>fill; fill = 0xff; }
>------------------------------------------------------------‍‍

Do you have a patch for a fix? 

--joel



More information about the users mailing list