summaryrefslogtreecommitdiff
authorTao Zeng <tao.zeng@amlogic.com>2019-12-10 02:35:12 (GMT)
committer Tao Zeng <tao.zeng@amlogic.com>2019-12-13 01:24:59 (GMT)
commit3bfde1d85bb56d457183a8facf60a692fedb7891 (patch)
treeae02bc98d39aefe6edc2375e70fa465ad82c51be
parent329c85246c449d77e5fbdb7b11b5e5bbf71fe5b5 (diff)
downloaduboot-3bfde1d85bb56d457183a8facf60a692fedb7891.zip
uboot-3bfde1d85bb56d457183a8facf60a692fedb7891.tar.gz
uboot-3bfde1d85bb56d457183a8facf60a692fedb7891.tar.bz2
fs: fix case problem of filename in fat [1/1]
PD#TV-12432 Problem: If a file only have 8+3 file name, then the case of filename is incorrect for fatls. Solution: add case process for directory properties. Verify: x301 Change-Id: If6194be4cdb1092a5c45f4e077454de1b475451f Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
Diffstat
-rw-r--r--fs/fat/fat.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index bccc3e3..b49934d 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -131,27 +131,33 @@ static int dirdelim(char *str)
*/
static void get_name(dir_entry *dirent, char *s_name)
{
- char *ptr;
+ char *ptr, *dot = NULL;
memcpy(s_name, dirent->name, 8);
s_name[8] = '\0';
ptr = s_name;
while (*ptr && *ptr != ' ')
ptr++;
+ if (dirent->lcase & 0x08) { /* down case for 8 */
+ downcase(s_name);
+ }
if (dirent->ext[0] && dirent->ext[0] != ' ') {
*ptr = '.';
ptr++;
+ dot = ptr;
memcpy(ptr, dirent->ext, 3);
ptr[3] = '\0';
while (*ptr && *ptr != ' ')
ptr++;
}
*ptr = '\0';
+ if (dot && dirent->lcase & 0x10) { /* down case for 3 */
+ downcase(dot);
+ }
if (*s_name == DELETED_FLAG)
*s_name = '\0';
else if (*s_name == aRING)
*s_name = DELETED_FLAG;
- downcase(s_name);
}
/*
@@ -544,7 +550,6 @@ get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
*l_name = '\0';
else if (*l_name == aRING)
*l_name = DELETED_FLAG;
- downcase(l_name);
/* Return the real directory entry */
memcpy(retdent, realdent, sizeof(dir_entry));
@@ -893,7 +898,6 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
/* Make a copy of the filename and convert it to lowercase */
strcpy(fnamecopy, filename);
- downcase(fnamecopy);
if (*fnamecopy == '\0') {
if (!dols)