diff options
author | wdenk <wdenk> | 2003-06-27 21:31:46 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-06-27 21:31:46 +0000 |
commit | 8bde7f776c77b343aca29b8c7b58464d915ac245 (patch) | |
tree | 20f1fd99975215e7c658454a15cdb4ed4694e2d4 /fs/fdos/fdos.c | |
parent | 993cad9364c6b87ae429d1ed1130d8153f6f027e (diff) | |
download | u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.zip u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.gz u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.bz2 |
* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)
* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'fs/fdos/fdos.c')
-rw-r--r-- | fs/fdos/fdos.c | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/fs/fdos/fdos.c b/fs/fdos/fdos.c index 8963f42..a29f43d 100644 --- a/fs/fdos/fdos.c +++ b/fs/fdos/fdos.c @@ -37,7 +37,7 @@ Fs_t fs; File_t file; /*----------------------------------------------------------------------------- - * dos_open -- + * dos_open -- *----------------------------------------------------------------------------- */ int dos_open(char *name) @@ -45,59 +45,59 @@ int dos_open(char *name) int lg; int entry; char *fname; - + /* We need to suppress the " char around the name */ if (name [0] == '"') { - name ++; + name ++; } lg = strlen (name); if (name [lg - 1] == '"') { - name [lg - 1] = '\0'; + name [lg - 1] = '\0'; } /* Open file system */ if (fs_init (&fs) < 0) { - return -1; + return -1; } /* Init the file descriptor */ file.name = name; file.fs = &fs; - + /* find the subdirectory containing the file */ if (open_subdir (&file) < 0) { - return (-1); + return (-1); } fname = basename (name); /* if we try to open root directory */ if (*fname == '\0') { - file.file = file.subdir; - return (0); + file.file = file.subdir; + return (0); } - + /* find the file in the subdir */ entry = 0; if (vfat_lookup (&file.subdir, - file.fs, - &file.file.dir, - &entry, - 0, - fname, - ACCEPT_DIR | ACCEPT_PLAIN | SINGLE | DO_OPEN, - 0, - &file.file) != 0) { - /* File not found */ - printf ("File not found\n"); - return (-1); + file.fs, + &file.file.dir, + &entry, + 0, + fname, + ACCEPT_DIR | ACCEPT_PLAIN | SINGLE | DO_OPEN, + 0, + &file.file) != 0) { + /* File not found */ + printf ("File not found\n"); + return (-1); } return 0; } /*----------------------------------------------------------------------------- - * dos_read -- + * dos_read -- *----------------------------------------------------------------------------- */ int dos_read (ulong addr) @@ -106,27 +106,27 @@ int dos_read (ulong addr) /* Try to boot a directory ? */ if (file.file.dir.attr & (ATTR_DIRECTORY | ATTR_VOLUME)) { - printf ("Unable to boot %s !!\n", file.name); - return (-1); + printf ("Unable to boot %s !!\n", file.name); + return (-1); } while (read < file.file.FileSize) { - PRINTF ("read_file (%ld)\n", (file.file.FileSize - read)); - nb = read_file (&fs, - &file.file, - (char *)addr + read, - read, - (file.file.FileSize - read)); - PRINTF ("read_file -> %d\n", nb); - if (nb < 0) { - printf ("read error\n"); - return (-1); - } - read += nb; + PRINTF ("read_file (%ld)\n", (file.file.FileSize - read)); + nb = read_file (&fs, + &file.file, + (char *)addr + read, + read, + (file.file.FileSize - read)); + PRINTF ("read_file -> %d\n", nb); + if (nb < 0) { + printf ("read error\n"); + return (-1); + } + read += nb; } return (read); } /*----------------------------------------------------------------------------- - * dos_dir -- + * dos_dir -- *----------------------------------------------------------------------------- */ int dos_dir (void) @@ -134,39 +134,39 @@ int dos_dir (void) int entry; Directory_t dir; char *name; - - + + if ((file.file.dir.attr & ATTR_DIRECTORY) == 0) { - printf ("%s: not a directory !!\n", file.name); - return (1); + printf ("%s: not a directory !!\n", file.name); + return (1); } entry = 0; if ((name = malloc (MAX_VNAMELEN + 1)) == NULL) { - PRINTF ("Allcation error\n"); - return (1); + PRINTF ("Allcation error\n"); + return (1); } - + while (vfat_lookup (&file.file, - file.fs, - &dir, - &entry, - 0, - NULL, - ACCEPT_DIR | ACCEPT_PLAIN | MATCH_ANY, - name, - NULL) == 0) { - /* Display file info */ - printf ("%3.3s %9d %s %02d %04d %02d:%02d:%02d %s\n", - (dir.attr & ATTR_DIRECTORY) ? "dir" : " ", - __le32_to_cpu (dir.size), - month [DOS_MONTH (&dir) - 1], - DOS_DAY (&dir), - DOS_YEAR (&dir), - DOS_HOUR (&dir), - DOS_MINUTE (&dir), - DOS_SEC (&dir), - name); - + file.fs, + &dir, + &entry, + 0, + NULL, + ACCEPT_DIR | ACCEPT_PLAIN | MATCH_ANY, + name, + NULL) == 0) { + /* Display file info */ + printf ("%3.3s %9d %s %02d %04d %02d:%02d:%02d %s\n", + (dir.attr & ATTR_DIRECTORY) ? "dir" : " ", + __le32_to_cpu (dir.size), + month [DOS_MONTH (&dir) - 1], + DOS_DAY (&dir), + DOS_YEAR (&dir), + DOS_HOUR (&dir), + DOS_MINUTE (&dir), + DOS_SEC (&dir), + name); + } free (name); return (0); |