Re: [U-Boot] [PATCH 6/8] fat/fs: remove a bunch of dead code

2017-08-13 Thread Stefan Bruens
On Sonntag, 13. August 2017 12:45:26 CEST Rob Clark wrote:
> Spotted by chance, when trying to remove file_fat_ls(), I noticed there
> were some dead users of the API.
> 
> Signed-off-by: Rob Clark 
> ---
>  fs/fat/Makefile |   4 --
>  fs/fat/file.c   | 183
>  include/fat.h   | 
> 20 ---
>  3 files changed, 207 deletions(-)
>  delete mode 100644 fs/fat/file.c
> 

This patch:
Acked-by: Stefan Brüns 

-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
home: +49 241 53809034 mobile: +49 151 50412019
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 6/8] fat/fs: remove a bunch of dead code

2017-08-13 Thread Rob Clark
Spotted by chance, when trying to remove file_fat_ls(), I noticed there
were some dead users of the API.

Signed-off-by: Rob Clark 
---
 fs/fat/Makefile |   4 --
 fs/fat/file.c   | 183 
 include/fat.h   |  20 ---
 3 files changed, 207 deletions(-)
 delete mode 100644 fs/fat/file.c

diff --git a/fs/fat/Makefile b/fs/fat/Makefile
index b60e8486c4..3e2a6b01a8 100644
--- a/fs/fat/Makefile
+++ b/fs/fat/Makefile
@@ -5,7 +5,3 @@
 
 obj-$(CONFIG_FS_FAT)   := fat.o
 obj-$(CONFIG_FAT_WRITE):= fat_write.o
-
-ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_FS_FAT)   += file.o
-endif
diff --git a/fs/fat/file.c b/fs/fat/file.c
deleted file mode 100644
index 89706117b9..00
--- a/fs/fat/file.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * file.c
- *
- * Mini "VFS" by Marcus Sundberg
- *
- * 2002-07-28 - rjo...@nexus-tech.net - ported to ppcboot v1.1.6
- * 2003-03-10 - khar...@nexus-tech.net - ported to uboot
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* Supported filesystems */
-static const struct filesystem filesystems[] = {
-   { file_fat_detectfs,  file_fat_ls,  file_fat_read,  "FAT" },
-};
-#define NUM_FILESYS(sizeof(filesystems)/sizeof(struct filesystem))
-
-/* The filesystem which was last detected */
-static int current_filesystem = FSTYPE_NONE;
-
-/* The current working directory */
-#define CWD_LEN511
-char file_cwd[CWD_LEN+1] = "/";
-
-const char *
-file_getfsname(int idx)
-{
-   if (idx < 0 || idx >= NUM_FILESYS)
-   return NULL;
-
-   return filesystems[idx].name;
-}
-
-static void
-pathcpy(char *dest, const char *src)
-{
-   char *origdest = dest;
-
-   do {
-   if (dest-file_cwd >= CWD_LEN) {
-   *dest = '\0';
-   return;
-   }
-   *(dest) = *(src);
-   if (*src == '\0') {
-   if (dest-- != origdest && ISDIRDELIM(*dest)) {
-   *dest = '\0';
-   }
-   return;
-   }
-   ++dest;
-
-   if (ISDIRDELIM(*src))
-   while (ISDIRDELIM(*src)) src++;
-   else
-   src++;
-   } while (1);
-}
-
-int
-file_cd(const char *path)
-{
-   if (ISDIRDELIM(*path)) {
-   while (ISDIRDELIM(*path)) path++;
-   strncpy(file_cwd+1, path, CWD_LEN-1);
-   } else {
-   const char *origpath = path;
-   char *tmpstr = file_cwd;
-   int back = 0;
-
-   while (*tmpstr != '\0') tmpstr++;
-   do {
-   tmpstr--;
-   } while (ISDIRDELIM(*tmpstr));
-
-   while (*path == '.') {
-   path++;
-   while (*path == '.') {
-   path++;
-   back++;
-   }
-   if (*path != '\0' && !ISDIRDELIM(*path)) {
-   path = origpath;
-   back = 0;
-   break;
-   }
-   while (ISDIRDELIM(*path)) path++;
-   origpath = path;
-   }
-
-   while (back--) {
-   /* Strip off path component */
-   while (!ISDIRDELIM(*tmpstr)) {
-   tmpstr--;
-   }
-   if (tmpstr == file_cwd) {
-   /* Incremented again right after the loop. */
-   tmpstr--;
-   break;
-   }
-   /* Skip delimiters */
-   while (ISDIRDELIM(*tmpstr)) tmpstr--;
-   }
-   tmpstr++;
-   if (*path == '\0') {
-   if (tmpstr == file_cwd) {
-   *tmpstr = '/';
-   tmpstr++;
-   }
-   *tmpstr = '\0';
-   return 0;
-   }
-   *tmpstr = '/';
-   pathcpy(tmpstr+1, path);
-   }
-
-   return 0;
-}
-
-int
-file_detectfs(void)
-{
-   int i;
-
-   current_filesystem = FSTYPE_NONE;
-
-   for (i = 0; i < NUM_FILESYS; i++) {
-   if (filesystems[i].detect() == 0) {
-   strcpy(file_cwd, "/");
-   current_filesystem = i;
-   break;
-   }
-   }
-
-   return current_filesystem;
-}
-
-int
-file_ls(const char *dir)
-{
-   char fullpath[1024];
-   const char *arg;
-
-   if (current_filesystem == FSTYPE_NONE) {
-   printf("Can't list files without a filesystem!\n");