4 * R/O (V)FAT 12/16/32 filesystem implementation by Marcus Sundberg
6 * 2002-07-28 - rjones@nexus-tech.net - ported to ppcboot v1.1.6
7 * 2003-03-10 - kharris@nexus-tech.net - ported to uboot
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 #include <asm/byteorder.h>
34 #if (CONFIG_COMMANDS & CFG_CMD_FAT)
37 * Convert a string to lowercase.
42 while (*str != '\0') {
48 static block_dev_desc_t *cur_dev = NULL;
49 static unsigned long part_offset = 0;
50 static int cur_part = 1;
52 #define DOS_PART_TBL_OFFSET 0x1be
53 #define DOS_PART_MAGIC_OFFSET 0x1fe
54 #define DOS_FS_TYPE_OFFSET 0x36
56 int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr)
58 startblock += part_offset;
61 if (cur_dev->block_read) {
62 return cur_dev->block_read (cur_dev->dev, startblock, getsize, (unsigned long *)bufptr);
69 fat_register_device(block_dev_desc_t *dev_desc, int part_no)
71 unsigned char buffer[SECTOR_SIZE];
73 if (!dev_desc->block_read)
76 /* check if we have a MBR (on floppies we have only a PBR) */
77 if (dev_desc->block_read (dev_desc->dev, 0, 1, (ulong *) buffer) != 1) {
78 printf ("** Can't read from device %d **\n", dev_desc->dev);
81 if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
82 buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
83 /* no signature found */
86 if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
87 /* ok, we assume we are on a PBR only */
92 #if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \
93 (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
94 (CONFIG_COMMANDS & CFG_CMD_USB) || \
95 (defined(CONFIG_MMC) && defined(CONFIG_LPC2292)) || \
96 defined(CONFIG_SYSTEMACE) )
97 disk_partition_t info;
98 if(!get_partition_info(dev_desc, part_no, &info)) {
99 part_offset = info.start;
103 printf ("** Partition %d not valid on device %d **\n",part_no,dev_desc->dev);
107 /* FIXME we need to determine the start block of the
108 * partition where the DOS FS resides. This can be done
109 * by using the get_partition_info routine. For this
110 * purpose the libpart must be included.
121 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
122 * Return index into string if found, -1 otherwise.
129 while (*str != '\0') {
130 if (ISDIRDELIM(*str)) return str - start;
138 * Match volume_info fs_type strings.
139 * Return 0 on match, -1 otherwise.
142 compare_sign(char *str1, char *str2)
144 char *end = str1+SIGNLEN;
146 while (str1 != end) {
147 if (*str1 != *str2) {
159 * Extract zero terminated short name from a directory entry.
161 static void get_name (dir_entry *dirent, char *s_name)
165 memcpy (s_name, dirent->name, 8);
168 while (*ptr && *ptr != ' ')
170 if (dirent->ext[0] && dirent->ext[0] != ' ') {
173 memcpy (ptr, dirent->ext, 3);
175 while (*ptr && *ptr != ' ')
179 if (*s_name == DELETED_FLAG)
181 else if (*s_name == aRING)
187 * Get the entry at index 'entry' in a FAT (12/16/32) table.
188 * On failure 0x00 is returned.
191 get_fatent(fsdata *mydata, __u32 entry)
197 switch (mydata->fatsize) {
199 bufnum = entry / FAT32BUFSIZE;
200 offset = entry - bufnum * FAT32BUFSIZE;
203 bufnum = entry / FAT16BUFSIZE;
204 offset = entry - bufnum * FAT16BUFSIZE;
207 bufnum = entry / FAT12BUFSIZE;
208 offset = entry - bufnum * FAT12BUFSIZE;
212 /* Unsupported FAT size */
216 /* Read a new block of FAT entries into the cache. */
217 if (bufnum != mydata->fatbufnum) {
218 int getsize = FATBUFSIZE/FS_BLOCK_SIZE;
219 __u8 *bufptr = mydata->fatbuf;
220 __u32 fatlength = mydata->fatlength;
221 __u32 startblock = bufnum * FATBUFBLOCKS;
223 fatlength *= SECTOR_SIZE; /* We want it in bytes now */
224 startblock += mydata->fat_sect; /* Offset from start of disk */
226 if (getsize > fatlength) getsize = fatlength;
227 if (disk_read(startblock, getsize, bufptr) < 0) {
228 FAT_DPRINT("Error reading FAT blocks\n");
231 mydata->fatbufnum = bufnum;
234 /* Get the actual entry from the table */
235 switch (mydata->fatsize) {
237 ret = FAT2CPU32(((__u32*)mydata->fatbuf)[offset]);
240 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[offset]);
243 __u32 off16 = (offset*3)/4;
246 switch (offset & 0x3) {
248 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
252 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
254 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
256 ret = (val2 << 4) | (val1 >> 12);
259 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
261 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
263 ret = (val2 << 8) | (val1 >> 8);
266 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);;
267 ret = (ret & 0xfff0) >> 4;
275 FAT_DPRINT("ret: %d, offset: %d\n", ret, offset);
282 * Read at most 'size' bytes from the specified cluster into 'buffer'.
283 * Return 0 on success, -1 otherwise.
286 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
292 startsect = mydata->data_begin + clustnum*mydata->clust_size;
294 startsect = mydata->rootdir_sect;
297 FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
298 if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
299 FAT_DPRINT("Error reading data\n");
302 if(size % FS_BLOCK_SIZE) {
303 __u8 tmpbuf[FS_BLOCK_SIZE];
304 idx= size/FS_BLOCK_SIZE;
305 if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
306 FAT_DPRINT("Error reading data\n");
309 buffer += idx*FS_BLOCK_SIZE;
311 memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
320 * Read at most 'maxsize' bytes from the file associated with 'dentptr'
322 * Return the number of bytes read or -1 on fatal errors.
325 get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
326 unsigned long maxsize)
328 unsigned long filesize = FAT2CPU32(dentptr->size), gotsize = 0;
329 unsigned int bytesperclust = mydata->clust_size * SECTOR_SIZE;
330 __u32 curclust = START(dentptr);
331 __u32 endclust, newclust;
332 unsigned long actsize;
334 FAT_DPRINT("Filesize: %ld bytes\n", filesize);
336 if (maxsize > 0 && filesize > maxsize) filesize = maxsize;
338 FAT_DPRINT("Reading: %ld bytes\n", filesize);
340 actsize=bytesperclust;
343 /* search for consecutive clusters */
344 while(actsize < filesize) {
345 newclust = get_fatent(mydata, endclust);
346 if((newclust -1)!=endclust)
348 if (newclust <= 0x0001 || newclust >= 0xfff0) {
349 FAT_DPRINT("curclust: 0x%x\n", newclust);
350 FAT_DPRINT("Invalid FAT entry\n");
354 actsize+= bytesperclust;
356 /* actsize >= file size */
357 actsize -= bytesperclust;
358 /* get remaining clusters */
359 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
360 FAT_ERROR("Error reading cluster\n");
363 /* get remaining bytes */
364 gotsize += (int)actsize;
368 if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
369 FAT_ERROR("Error reading cluster\n");
375 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
376 FAT_ERROR("Error reading cluster\n");
379 gotsize += (int)actsize;
382 curclust = get_fatent(mydata, endclust);
383 if (curclust <= 0x0001 || curclust >= 0xfff0) {
384 FAT_DPRINT("curclust: 0x%x\n", curclust);
385 FAT_ERROR("Invalid FAT entry\n");
388 actsize=bytesperclust;
394 #ifdef CONFIG_SUPPORT_VFAT
396 * Extract the file name information from 'slotptr' into 'l_name',
397 * starting at l_name[*idx].
398 * Return 1 if terminator (zero byte) is found, 0 otherwise.
401 slot2str(dir_slot *slotptr, char *l_name, int *idx)
405 for (j = 0; j <= 8; j += 2) {
406 l_name[*idx] = slotptr->name0_4[j];
407 if (l_name[*idx] == 0x00) return 1;
410 for (j = 0; j <= 10; j += 2) {
411 l_name[*idx] = slotptr->name5_10[j];
412 if (l_name[*idx] == 0x00) return 1;
415 for (j = 0; j <= 2; j += 2) {
416 l_name[*idx] = slotptr->name11_12[j];
417 if (l_name[*idx] == 0x00) return 1;
426 * Extract the full long filename starting at 'retdent' (which is really
427 * a slot) into 'l_name'. If successful also copy the real directory entry
429 * Return 0 on success, -1 otherwise.
431 __u8 get_vfatname_block[MAX_CLUSTSIZE];
433 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
434 dir_entry *retdent, char *l_name)
437 dir_slot *slotptr = (dir_slot*) retdent;
438 __u8 *nextclust = cluster + mydata->clust_size * SECTOR_SIZE;
439 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
442 while ((__u8*)slotptr < nextclust) {
443 if (counter == 0) break;
444 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
450 if ((__u8*)slotptr >= nextclust) {
454 curclust = get_fatent(mydata, curclust);
455 if (curclust <= 0x0001 || curclust >= 0xfff0) {
456 FAT_DPRINT("curclust: 0x%x\n", curclust);
457 FAT_ERROR("Invalid FAT entry\n");
460 if (get_cluster(mydata, curclust, get_vfatname_block,
461 mydata->clust_size * SECTOR_SIZE) != 0) {
462 FAT_DPRINT("Error: reading directory block\n");
465 slotptr2 = (dir_slot*) get_vfatname_block;
466 while (slotptr2->id > 0x01) {
469 /* Save the real directory entry */
470 realdent = (dir_entry*)slotptr2 + 1;
471 while ((__u8*)slotptr2 >= get_vfatname_block) {
472 slot2str(slotptr2, l_name, &idx);
476 /* Save the real directory entry */
477 realdent = (dir_entry*)slotptr;
482 if (slot2str(slotptr, l_name, &idx)) break;
483 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
486 if (*l_name == DELETED_FLAG) *l_name = '\0';
487 else if (*l_name == aRING) *l_name = 'å';
490 /* Return the real directory entry */
491 memcpy(retdent, realdent, sizeof(dir_entry));
497 /* Calculate short name checksum */
499 mkcksum(const char *str)
504 for (i = 0; i < 11; i++) {
505 ret = (((ret&1)<<7)|((ret&0xfe)>>1)) + str[i];
514 * Get the directory entry associated with 'filename' from the directory
515 * starting at 'startsect'
517 __u8 get_dentfromdir_block[MAX_CLUSTSIZE];
518 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
519 char *filename, dir_entry * retdent,
522 __u16 prevcksum = 0xffff;
523 __u32 curclust = START (retdent);
524 int files = 0, dirs = 0;
526 FAT_DPRINT ("get_dentfromdir: %s\n", filename);
531 if (get_cluster (mydata, curclust, get_dentfromdir_block,
532 mydata->clust_size * SECTOR_SIZE) != 0) {
533 FAT_DPRINT ("Error: reading directory block\n");
536 dentptr = (dir_entry *) get_dentfromdir_block;
537 for (i = 0; i < DIRENTSPERCLUST; i++) {
538 char s_name[14], l_name[256];
541 if (dentptr->name[0] == DELETED_FLAG) {
545 if ((dentptr->attr & ATTR_VOLUME)) {
546 #ifdef CONFIG_SUPPORT_VFAT
547 if ((dentptr->attr & ATTR_VFAT) &&
548 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
549 prevcksum = ((dir_slot *) dentptr)
551 get_vfatname (mydata, curclust, get_dentfromdir_block,
554 int isdir = (dentptr->attr & ATTR_DIR);
564 if (l_name[0] != 0) {
571 printf (" %8ld %s%c\n",
572 (long) FAT2CPU32 (dentptr->size),
575 printf (" %s%c\n", l_name, dirc);
581 FAT_DPRINT ("vfatname: |%s|\n", l_name);
585 /* Volume label or VFAT entry */
590 if (dentptr->name[0] == 0) {
592 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
594 FAT_DPRINT ("Dentname == NULL - %d\n", i);
597 #ifdef CONFIG_SUPPORT_VFAT
598 if (dols && mkcksum (dentptr->name) == prevcksum) {
603 get_name (dentptr, s_name);
605 int isdir = (dentptr->attr & ATTR_DIR);
615 if (s_name[0] != 0) {
622 printf (" %8ld %s%c\n",
623 (long) FAT2CPU32 (dentptr->size), s_name,
626 printf (" %s%c\n", s_name, dirc);
632 if (strcmp (filename, s_name) && strcmp (filename, l_name)) {
633 FAT_DPRINT ("Mismatch: |%s|%s|\n", s_name, l_name);
637 memcpy (retdent, dentptr, sizeof (dir_entry));
639 FAT_DPRINT ("DentName: %s", s_name);
640 FAT_DPRINT (", start: 0x%x", START (dentptr));
641 FAT_DPRINT (", size: 0x%x %s\n",
642 FAT2CPU32 (dentptr->size),
643 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
647 curclust = get_fatent (mydata, curclust);
648 if (curclust <= 0x0001 || curclust >= 0xfff0) {
649 FAT_DPRINT ("curclust: 0x%x\n", curclust);
650 FAT_ERROR ("Invalid FAT entry\n");
660 * Read boot sector and volume info from a FAT filesystem
663 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
665 __u8 block[FS_BLOCK_SIZE];
666 volume_info *vistart;
668 if (disk_read(0, 1, block) < 0) {
669 FAT_DPRINT("Error: reading block\n");
673 memcpy(bs, block, sizeof(boot_sector));
674 bs->reserved = FAT2CPU16(bs->reserved);
675 bs->fat_length = FAT2CPU16(bs->fat_length);
676 bs->secs_track = FAT2CPU16(bs->secs_track);
677 bs->heads = FAT2CPU16(bs->heads);
679 bs->hidden = FAT2CPU32(bs->hidden);
681 bs->total_sect = FAT2CPU32(bs->total_sect);
684 if (bs->fat_length == 0) {
686 bs->fat32_length = FAT2CPU32(bs->fat32_length);
687 bs->flags = FAT2CPU16(bs->flags);
688 bs->root_cluster = FAT2CPU32(bs->root_cluster);
689 bs->info_sector = FAT2CPU16(bs->info_sector);
690 bs->backup_boot = FAT2CPU16(bs->backup_boot);
691 vistart = (volume_info*) (block + sizeof(boot_sector));
694 vistart = (volume_info*) &(bs->fat32_length);
697 memcpy(volinfo, vistart, sizeof(volume_info));
699 /* Terminate fs_type string. Writing past the end of vistart
700 is ok - it's just the buffer. */
701 vistart->fs_type[8] = '\0';
703 if (*fatsize == 32) {
704 if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
708 if (compare_sign(FAT12_SIGN, vistart->fs_type) == 0) {
712 if (compare_sign(FAT16_SIGN, vistart->fs_type) == 0) {
718 FAT_DPRINT("Error: broken fs_type sign\n");
723 __u8 do_fat_read_block[MAX_CLUSTSIZE]; /* Block buffer */
725 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
728 #if CONFIG_NIOS /* NIOS CPU cannot access big automatic arrays */
731 char fnamecopy[2048];
735 fsdata *mydata = &datablock;
737 __u16 prevcksum = 0xffff;
739 int rootdir_size, cursect;
741 int files = 0, dirs = 0;
745 if (read_bootsectandvi (&bs, &volinfo, &mydata->fatsize)) {
746 FAT_DPRINT ("Error: reading boot sector\n");
749 if (mydata->fatsize == 32) {
750 mydata->fatlength = bs.fat32_length;
752 mydata->fatlength = bs.fat_length;
754 mydata->fat_sect = bs.reserved;
755 cursect = mydata->rootdir_sect
756 = mydata->fat_sect + mydata->fatlength * bs.fats;
757 mydata->clust_size = bs.cluster_size;
758 if (mydata->fatsize == 32) {
759 rootdir_size = mydata->clust_size;
760 mydata->data_begin = mydata->rootdir_sect /* + rootdir_size */
761 - (mydata->clust_size * 2);
763 rootdir_size = ((bs.dir_entries[1] * (int) 256 + bs.dir_entries[0])
764 * sizeof (dir_entry)) / SECTOR_SIZE;
765 mydata->data_begin = mydata->rootdir_sect + rootdir_size
766 - (mydata->clust_size * 2);
768 mydata->fatbufnum = -1;
770 FAT_DPRINT ("FAT%d, fatlength: %d\n", mydata->fatsize,
772 FAT_DPRINT ("Rootdir begins at sector: %d, offset: %x, size: %d\n"
773 "Data begins at: %d\n",
774 mydata->rootdir_sect, mydata->rootdir_sect * SECTOR_SIZE,
775 rootdir_size, mydata->data_begin);
776 FAT_DPRINT ("Cluster size: %d\n", mydata->clust_size);
778 /* "cwd" is always the root... */
779 while (ISDIRDELIM (*filename))
781 /* Make a copy of the filename and convert it to lowercase */
782 strcpy (fnamecopy, filename);
783 downcase (fnamecopy);
784 if (*fnamecopy == '\0') {
788 } else if ((idx = dirdelim (fnamecopy)) >= 0) {
790 fnamecopy[idx] = '\0';
791 subname = fnamecopy + idx + 1;
792 /* Handle multiple delimiters */
793 while (ISDIRDELIM (*subname))
802 if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
803 FAT_DPRINT ("Error: reading rootdir block\n");
806 dentptr = (dir_entry *) do_fat_read_block;
807 for (i = 0; i < DIRENTSPERBLOCK; i++) {
808 char s_name[14], l_name[256];
811 if ((dentptr->attr & ATTR_VOLUME)) {
812 #ifdef CONFIG_SUPPORT_VFAT
813 if ((dentptr->attr & ATTR_VFAT) &&
814 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
815 prevcksum = ((dir_slot *) dentptr)->alias_checksum;
816 get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
817 if (dols == LS_ROOT) {
818 int isdir = (dentptr->attr & ATTR_DIR);
828 if (l_name[0] != 0) {
835 printf (" %8ld %s%c\n",
836 (long) FAT2CPU32 (dentptr->size),
839 printf (" %s%c\n", l_name, dirc);
845 FAT_DPRINT ("Rootvfatname: |%s|\n", l_name);
849 /* Volume label or VFAT entry */
853 } else if (dentptr->name[0] == 0) {
854 FAT_DPRINT ("RootDentname == NULL - %d\n", i);
855 if (dols == LS_ROOT) {
856 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
861 #ifdef CONFIG_SUPPORT_VFAT
862 else if (dols == LS_ROOT
863 && mkcksum (dentptr->name) == prevcksum) {
868 get_name (dentptr, s_name);
869 if (dols == LS_ROOT) {
870 int isdir = (dentptr->attr & ATTR_DIR);
876 if (s_name[0] != 0) {
882 if (s_name[0] != 0) {
889 printf (" %8ld %s%c\n",
890 (long) FAT2CPU32 (dentptr->size), s_name,
893 printf (" %s%c\n", s_name, dirc);
899 if (strcmp (fnamecopy, s_name) && strcmp (fnamecopy, l_name)) {
900 FAT_DPRINT ("RootMismatch: |%s|%s|\n", s_name, l_name);
904 if (isdir && !(dentptr->attr & ATTR_DIR))
907 FAT_DPRINT ("RootName: %s", s_name);
908 FAT_DPRINT (", start: 0x%x", START (dentptr));
909 FAT_DPRINT (", size: 0x%x %s\n",
910 FAT2CPU32 (dentptr->size), isdir ? "(DIR)" : "");
912 goto rootdir_done; /* We got a match */
920 int startsect = mydata->data_begin
921 + START (dentptr) * mydata->clust_size;
923 char *nextname = NULL;
928 idx = dirdelim (subname);
931 nextname = subname + idx + 1;
932 /* Handle multiple delimiters */
933 while (ISDIRDELIM (*nextname))
935 if (dols && *nextname == '\0')
938 if (dols && firsttime) {
945 if (get_dentfromdir (mydata, startsect, subname, dentptr,
946 isdir ? 0 : dols) == NULL) {
953 if (!(dentptr->attr & ATTR_DIR))
958 ret = get_contents (mydata, dentptr, buffer, maxsize);
959 FAT_DPRINT ("Size: %d, got: %ld\n", FAT2CPU32 (dentptr->size), ret);
966 file_fat_detectfs(void)
974 printf("No current device\n");
977 #if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
978 (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_MMC)
979 printf("Interface: ");
980 switch(cur_dev->if_type) {
981 case IF_TYPE_IDE : printf("IDE"); break;
982 case IF_TYPE_SCSI : printf("SCSI"); break;
983 case IF_TYPE_ATAPI : printf("ATAPI"); break;
984 case IF_TYPE_USB : printf("USB"); break;
985 case IF_TYPE_DOC : printf("DOC"); break;
986 case IF_TYPE_MMC : printf("MMC"); break;
987 default : printf("Unknown");
989 printf("\n Device %d: ",cur_dev->dev);
992 if(read_bootsectandvi(&bs, &volinfo, &fatsize)) {
993 printf("\nNo valid FAT fs found\n");
996 memcpy (vol_label, volinfo.volume_label, 11);
997 vol_label[11] = '\0';
998 volinfo.fs_type[5]='\0';
999 printf("Partition %d: Filesystem: %s \"%s\"\n",cur_part,volinfo.fs_type,vol_label);
1005 file_fat_ls(const char *dir)
1007 return do_fat_read(dir, NULL, 0, LS_YES);
1012 file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
1014 printf("reading %s\n",filename);
1015 return do_fat_read(filename, buffer, maxsize, LS_NO);
1018 #endif /* #if (CONFIG_COMMANDS & CFG_CMD_FAT) */