fs/fat: Fix a bug that long file name cannot be found
The field of first cluster under LFN directory entry must be 0x0000. If it is set a value other than 0, it causes a problem where the long file name entry cannot be found on a Windows PC and the short file name is always used. In addition, correct the macro error in big endian.
This commit is contained in:
parent
34e7ce5817
commit
fa1fad50b9
@ -653,19 +653,20 @@
|
||||
# define DIR_PUTFILESIZE(p,v) fat_putuint32(UBYTE_PTR(p,DIR_FILESIZE),v)
|
||||
|
||||
# ifdef CONFIG_FAT_LFN
|
||||
# define LDIR_PUTWCHAR1(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5),v)
|
||||
# define LDIR_PUTWCHAR2(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+2),v)
|
||||
# define LDIR_PUTWCHAR3(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+4),v)
|
||||
# define LDIR_PUTWCHAR4(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+6),v)
|
||||
# define LDIR_PUTWCHAR5(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+8),v)
|
||||
# define LDIR_PUTWCHAR6(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11),v)
|
||||
# define LDIR_PUTWCHAR7(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+2),v)
|
||||
# define LDIR_PUTWCHAR8(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+4),v)
|
||||
# define LDIR_PUTWCHAR9(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+6),v)
|
||||
# define LDIR_PUTWCHAR10(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+8),v)
|
||||
# define LDIR_PUTWCHAR11(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+10),v)
|
||||
# define LDIR_PUTWCHAR12(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR12_13),v)
|
||||
# define LDIR_PUTWCHAR13(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR12_13+2),v)
|
||||
# define LDIR_PUTWCHAR1(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5),v)
|
||||
# define LDIR_PUTWCHAR2(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+2),v)
|
||||
# define LDIR_PUTWCHAR3(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+4),v)
|
||||
# define LDIR_PUTWCHAR4(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+6),v)
|
||||
# define LDIR_PUTWCHAR5(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR1_5+8),v)
|
||||
# define LDIR_PUTWCHAR6(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11),v)
|
||||
# define LDIR_PUTWCHAR7(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+2),v)
|
||||
# define LDIR_PUTWCHAR8(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+4),v)
|
||||
# define LDIR_PUTWCHAR9(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+6),v)
|
||||
# define LDIR_PUTWCHAR10(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+8),v)
|
||||
# define LDIR_PUTWCHAR11(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+10),v)
|
||||
# define LDIR_PUTWCHAR12(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR12_13),v)
|
||||
# define LDIR_PUTWCHAR13(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR12_13+2),v)
|
||||
# define LDIR_PUTFSTCLUSTLO(p,v) fat_putuint16(UBYTE_PTR(p,LDIR_FSTCLUSTLO),v)
|
||||
# endif
|
||||
|
||||
# define FSI_PUTLEADSIG(p,v) fat_putuint32(UBYTE_PTR(p,FSI_LEADSIG),v)
|
||||
@ -808,6 +809,7 @@
|
||||
# define LDIR_PUTWCHAR11(p,v) UINT16_PUT(p,LDIR_WCHAR6_11+10,v)
|
||||
# define LDIR_PUTWCHAR12(p,v) UINT16_PUT(p,LDIR_WCHAR12_13,v)
|
||||
# define LDIR_PUTWCHAR13(p,v) UINT16_PUT(p,LDIR_WCHAR12_13+2,v)
|
||||
# define LDIR_PUTFSTCLUSTLO(p,v) UINT16_PUT(p,LDIR_FSTCLUSTLO,v)
|
||||
# endif
|
||||
|
||||
# define FSI_PUTLEADSIG(p,v) UINT32_PUT(p,FSI_LEADSIG,v)
|
||||
|
@ -2426,6 +2426,7 @@ static int fat_putlfname(FAR struct fat_mountpt_s *fs,
|
||||
LDIR_PUTATTRIBUTES(direntry, LDDIR_LFNATTR);
|
||||
LDIR_PUTNTRES(direntry, 0);
|
||||
LDIR_PUTCHECKSUM(direntry, checksum);
|
||||
LDIR_PUTFSTCLUSTLO(direntry, 0);
|
||||
fs->fs_dirty = true;
|
||||
|
||||
/* Read next directory entry */
|
||||
|
Loading…
Reference in New Issue
Block a user