summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>2023-03-17 13:04:13 +0100
committerTom Rini <trini@konsulko.com>2023-03-30 15:09:59 -0400
commitfefd949157430e1dc8569fa39729c63c5eccb454 (patch)
treee1c82633845366faea0d89fcf9faeab50d5f74d0 /fs
parent447dfbc0638f65accaeba1afa3b33840bdb46b6e (diff)
downloadu-boot-fefd949157430e1dc8569fa39729c63c5eccb454.tar.gz
u-boot-fefd949157430e1dc8569fa39729c63c5eccb454.tar.bz2
u-boot-fefd949157430e1dc8569fa39729c63c5eccb454.zip
fs: fat: do not mangle short filenames
Do not mangle lower or mixed case filenames which fit into the upper case 8.3 short filename. This ensures FAT standard compatible short filenames (SFN) to support systems without long filename (LFN) support like boot roms (ex. SFN BOOT.BIN instead of BOOT~1.BIN for LFN boot.bin). Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/fat/fat_write.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 00541ebc3a..413fc432eb 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -141,6 +141,8 @@ static int set_name(fat_itr *itr, const char *filename, char *shortname)
if (!strcmp(buf, filename)) {
ret = 1;
goto out;
+ } else if (!strcasecmp(buf, filename)) {
+ goto out_ret;
}
/* Construct an indexed short name */
@@ -177,12 +179,13 @@ static int set_name(fat_itr *itr, const char *filename, char *shortname)
if (find_directory_entry(itr, buf))
continue;
- debug("chosen short name: %s\n", buf);
- /* Each long name directory entry takes 13 characters. */
- ret = (strlen(filename) + 25) / 13;
- goto out;
+ goto out_ret;
}
return -EIO;
+out_ret:
+ debug("chosen short name: %s\n", buf);
+ /* Each long name directory entry takes 13 characters. */
+ ret = (strlen(filename) + 25) / 13;
out:
memcpy(shortname, &dirent, SHORT_NAME_SIZE);
return ret;