summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/fat/fat.c4
-rw-r--r--fs/fat/fat_write.c15
-rw-r--r--fs/fs.c20
3 files changed, 33 insertions, 6 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 7fd29470c1..9578b74bae 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -949,9 +949,7 @@ static int fat_itr_next(fat_itr *itr)
/* Volume label or VFAT entry, skip */
continue;
}
- } else if (!(dent->attr & ATTR_ARCH) &&
- !(dent->attr & ATTR_DIR))
- continue;
+ }
/* short file name */
break;
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 59cc0bae94..b16a39d3ff 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -50,8 +50,11 @@ static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
return ret;
}
-/*
- * Set short name in directory entry
+/**
+ * set_name() - set short name in directory entry
+ *
+ * @dirent: directory entry
+ * @filename: long file name
*/
static void set_name(dir_entry *dirent, const char *filename)
{
@@ -66,7 +69,8 @@ static void set_name(dir_entry *dirent, const char *filename)
if (len == 0)
return;
- strcpy(s_name, filename);
+ strncpy(s_name, filename, VFAT_MAXLEN_BYTES - 1);
+ s_name[VFAT_MAXLEN_BYTES - 1] = '\0';
uppercase(s_name, len);
period = strchr(s_name, '.');
@@ -87,6 +91,11 @@ static void set_name(dir_entry *dirent, const char *filename)
memcpy(dirent->name, s_name, period_location);
} else {
memcpy(dirent->name, s_name, 6);
+ /*
+ * TODO: Translating two long names with the same first six
+ * characters to the same short name is utterly wrong.
+ * Short names must be unique.
+ */
dirent->name[6] = '~';
dirent->name[7] = '1';
}
diff --git a/fs/fs.c b/fs/fs.c
index ad4caaeb1e..8f8938c3c6 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -903,3 +903,23 @@ int do_ln(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
return 0;
}
+
+int do_fs_types(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ struct fstype_info *drv = fstypes;
+ const int n_ents = ARRAY_SIZE(fstypes);
+ struct fstype_info *entry;
+ int i = 0;
+
+ puts("Supported filesystems");
+ for (entry = drv; entry != drv + n_ents; entry++) {
+ if (entry->fstype != FS_TYPE_ANY) {
+ printf("%c %s", i ? ',' : ':', entry->name);
+ i++;
+ }
+ }
+ if (!i)
+ puts(": <none>");
+ puts("\n");
+ return CMD_RET_SUCCESS;
+}