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
63 , startblock, getsize, (unsigned long *)bufptr);
70 fat_register_device(block_dev_desc_t *dev_desc, int part_no)
72 unsigned char buffer[SECTOR_SIZE];
74 if (!dev_desc->block_read)
77 /* check if we have a MBR (on floppies we have only a PBR) */
78 if (dev_desc->block_read (dev_desc->dev, 0, 1, (ulong *) buffer) != 1) {
79 printf ("** Can't read from device %d **\n", dev_desc->dev);
82 if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
83 buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
84 /* no signature found */
87 if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
88 /* ok, we assume we are on a PBR only */
93 #if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \
94 (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
95 (CONFIG_COMMANDS & CFG_CMD_USB) || \
96 (defined(CONFIG_MMC) && defined(CONFIG_LPC2292)) || \
97 defined(CONFIG_SYSTEMACE) )
98 disk_partition_t info;
99 if(!get_partition_info(dev_desc, part_no, &info)) {
100 part_offset = info.start;
104 printf ("** Partition %d not valid on device %d **\n",part_no,dev_desc->dev);
108 /* FIXME we need to determine the start block of the
109 * partition where the DOS FS resides. This can be done
110 * by using the get_partition_info routine. For this
111 * purpose the libpart must be included.
122 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
123 * Return index into string if found, -1 otherwise.
130 while (*str != '\0') {
131 if (ISDIRDELIM(*str)) return str - start;
139 * Match volume_info fs_type strings.
140 * Return 0 on match, -1 otherwise.
143 compare_sign(char *str1, char *str2)
145 char *end = str1+SIGNLEN;
147 while (str1 != end) {
148 if (*str1 != *str2) {
160 * Extract zero terminated short name from a directory entry.
162 static void get_name (dir_entry *dirent, char *s_name)
166 memcpy (s_name, dirent->name, 8);
169 while (*ptr && *ptr != ' ')
171 if (dirent->ext[0] && dirent->ext[0] != ' ') {
174 memcpy (ptr, dirent->ext, 3);
176 while (*ptr && *ptr != ' ')
180 if (*s_name == DELETED_FLAG)
182 else if (*s_name == aRING)
188 * Get the entry at index 'entry' in a FAT (12/16/32) table.
189 * On failure 0x00 is returned.
192 get_fatent(fsdata *mydata, __u32 entry)
198 switch (mydata->fatsize) {
200 bufnum = entry / FAT32BUFSIZE;
201 offset = entry - bufnum * FAT32BUFSIZE;
204 bufnum = entry / FAT16BUFSIZE;
205 offset = entry - bufnum * FAT16BUFSIZE;
208 bufnum = entry / FAT12BUFSIZE;
209 offset = entry - bufnum * FAT12BUFSIZE;
213 /* Unsupported FAT size */
217 /* Read a new block of FAT entries into the cache. */
218 if (bufnum != mydata->fatbufnum) {
219 int getsize = FATBUFSIZE/FS_BLOCK_SIZE;
220 __u8 *bufptr = mydata->fatbuf;
221 __u32 fatlength = mydata->fatlength;
222 __u32 startblock = bufnum * FATBUFBLOCKS;
224 fatlength *= SECTOR_SIZE; /* We want it in bytes now */
225 startblock += mydata->fat_sect; /* Offset from start of disk */
227 if (getsize > fatlength) getsize = fatlength;
228 if (disk_read(startblock, getsize, bufptr) < 0) {
229 FAT_DPRINT("Error reading FAT blocks\n");
232 mydata->fatbufnum = bufnum;
235 /* Get the actual entry from the table */
236 switch (mydata->fatsize) {
238 ret = FAT2CPU32(((__u32*)mydata->fatbuf)[offset]);
241 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[offset]);
244 __u32 off16 = (offset*3)/4;
247 switch (offset & 0x3) {
249 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
253 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
255 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
257 ret = (val2 << 4) | (val1 >> 12);
260 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
262 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
264 ret = (val2 << 8) | (val1 >> 8);
267 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);;
268 ret = (ret & 0xfff0) >> 4;
276 FAT_DPRINT("ret: %d, offset: %d\n", ret, offset);
283 * Read at most 'size' bytes from the specified cluster into 'buffer'.
284 * Return 0 on success, -1 otherwise.
287 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
293 startsect = mydata->data_begin + clustnum*mydata->clust_size;
295 startsect = mydata->rootdir_sect;
298 FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
299 if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
300 FAT_DPRINT("Error reading data\n");
303 if(size % FS_BLOCK_SIZE) {
304 __u8 tmpbuf[FS_BLOCK_SIZE];
305 idx= size/FS_BLOCK_SIZE;
306 if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
307 FAT_DPRINT("Error reading data\n");
310 buffer += idx*FS_BLOCK_SIZE;
312 memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
321 * Read at most 'maxsize' bytes from the file associated with 'dentptr'
323 * Return the number of bytes read or -1 on fatal errors.
326 get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
327 unsigned long maxsize)
329 unsigned long filesize = FAT2CPU32(dentptr->size), gotsize = 0;
330 unsigned int bytesperclust = mydata->clust_size * SECTOR_SIZE;
331 __u32 curclust = START(dentptr);
332 __u32 endclust, newclust;
333 unsigned long actsize;
335 FAT_DPRINT("Filesize: %ld bytes\n", filesize);
337 if (maxsize > 0 && filesize > maxsize) filesize = maxsize;
339 FAT_DPRINT("Reading: %ld bytes\n", filesize);
341 actsize=bytesperclust;
344 /* search for consecutive clusters */
345 while(actsize < filesize) {
346 newclust = get_fatent(mydata, endclust);
347 if((newclust -1)!=endclust)
349 if (newclust <= 0x0001 || newclust >= 0xfff0) {
350 FAT_DPRINT("curclust: 0x%x\n", newclust);
351 FAT_DPRINT("Invalid FAT entry\n");
355 actsize+= bytesperclust;
357 /* actsize >= file size */
358 actsize -= bytesperclust;
359 /* get remaining clusters */
360 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
361 FAT_ERROR("Error reading cluster\n");
364 /* get remaining bytes */
365 gotsize += (int)actsize;
369 if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
370 FAT_ERROR("Error reading cluster\n");
376 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
377 FAT_ERROR("Error reading cluster\n");
380 gotsize += (int)actsize;
383 curclust = get_fatent(mydata, endclust);
384 if (curclust <= 0x0001 || curclust >= 0xfff0) {
385 FAT_DPRINT("curclust: 0x%x\n", curclust);
386 FAT_ERROR("Invalid FAT entry\n");
389 actsize=bytesperclust;
395 #ifdef CONFIG_SUPPORT_VFAT
397 * Extract the file name information from 'slotptr' into 'l_name',
398 * starting at l_name[*idx].
399 * Return 1 if terminator (zero byte) is found, 0 otherwise.
402 slot2str(dir_slot *slotptr, char *l_name, int *idx)
406 for (j = 0; j <= 8; j += 2) {
407 l_name[*idx] = slotptr->name0_4[j];
408 if (l_name[*idx] == 0x00) return 1;
411 for (j = 0; j <= 10; j += 2) {
412 l_name[*idx] = slotptr->name5_10[j];
413 if (l_name[*idx] == 0x00) return 1;
416 for (j = 0; j <= 2; j += 2) {
417 l_name[*idx] = slotptr->name11_12[j];
418 if (l_name[*idx] == 0x00) return 1;
427 * Extract the full long filename starting at 'retdent' (which is really
428 * a slot) into 'l_name'. If successful also copy the real directory entry
430 * Return 0 on success, -1 otherwise.
432 __u8 get_vfatname_block[MAX_CLUSTSIZE];
434 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
435 dir_entry *retdent, char *l_name)
438 dir_slot *slotptr = (dir_slot*) retdent;
439 __u8 *nextclust = cluster + mydata->clust_size * SECTOR_SIZE;
440 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
443 while ((__u8*)slotptr < nextclust) {
444 if (counter == 0) break;
445 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
451 if ((__u8*)slotptr >= nextclust) {
455 curclust = get_fatent(mydata, curclust);
456 if (curclust <= 0x0001 || curclust >= 0xfff0) {
457 FAT_DPRINT("curclust: 0x%x\n", curclust);
458 FAT_ERROR("Invalid FAT entry\n");
461 if (get_cluster(mydata, curclust, get_vfatname_block,
462 mydata->clust_size * SECTOR_SIZE) != 0) {
463 FAT_DPRINT("Error: reading directory block\n");
466 slotptr2 = (dir_slot*) get_vfatname_block;
467 while (slotptr2->id > 0x01) {
470 /* Save the real directory entry */
471 realdent = (dir_entry*)slotptr2 + 1;
472 while ((__u8*)slotptr2 >= get_vfatname_block) {
473 slot2str(slotptr2, l_name, &idx);
477 /* Save the real directory entry */
478 realdent = (dir_entry*)slotptr;
483 if (slot2str(slotptr, l_name, &idx)) break;
484 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
487 if (*l_name == DELETED_FLAG) *l_name = '\0';
488 else if (*l_name == aRING) *l_name = 'å';
491 /* Return the real directory entry */
492 memcpy(retdent, realdent, sizeof(dir_entry));
498 /* Calculate short name checksum */
500 mkcksum(const char *str)
505 for (i = 0; i < 11; i++) {
506 ret = (((ret&1)<<7)|((ret&0xfe)>>1)) + str[i];
515 * Get the directory entry associated with 'filename' from the directory
516 * starting at 'startsect'
518 __u8 get_dentfromdir_block[MAX_CLUSTSIZE];
519 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
520 char *filename, dir_entry * retdent,
523 __u16 prevcksum = 0xffff;
524 __u32 curclust = START (retdent);
525 int files = 0, dirs = 0;
527 FAT_DPRINT ("get_dentfromdir: %s\n", filename);
532 if (get_cluster (mydata, curclust, get_dentfromdir_block,
533 mydata->clust_size * SECTOR_SIZE) != 0) {
534 FAT_DPRINT ("Error: reading directory block\n");
537 dentptr = (dir_entry *) get_dentfromdir_block;
538 for (i = 0; i < DIRENTSPERCLUST; i++) {
539 char s_name[14], l_name[256];
542 if (dentptr->name[0] == DELETED_FLAG) {
546 if ((dentptr->attr & ATTR_VOLUME)) {
547 #ifdef CONFIG_SUPPORT_VFAT
548 if ((dentptr->attr & ATTR_VFAT) &&
549 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
550 prevcksum = ((dir_slot *) dentptr)
552 get_vfatname (mydata, curclust, get_dentfromdir_block,
555 int isdir = (dentptr->attr & ATTR_DIR);
565 if (l_name[0] != 0) {
572 printf (" %8ld %s%c\n",
573 (long) FAT2CPU32 (dentptr->size),
576 printf (" %s%c\n", l_name, dirc);
582 FAT_DPRINT ("vfatname: |%s|\n", l_name);
586 /* Volume label or VFAT entry */
591 if (dentptr->name[0] == 0) {
593 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
595 FAT_DPRINT ("Dentname == NULL - %d\n", i);
598 #ifdef CONFIG_SUPPORT_VFAT
599 if (dols && mkcksum (dentptr->name) == prevcksum) {
604 get_name (dentptr, s_name);
606 int isdir = (dentptr->attr & ATTR_DIR);
616 if (s_name[0] != 0) {
623 printf (" %8ld %s%c\n",
624 (long) FAT2CPU32 (dentptr->size), s_name,
627 printf (" %s%c\n", s_name, dirc);
633 if (strcmp (filename, s_name) && strcmp (filename, l_name)) {
634 FAT_DPRINT ("Mismatch: |%s|%s|\n", s_name, l_name);
638 memcpy (retdent, dentptr, sizeof (dir_entry));
640 FAT_DPRINT ("DentName: %s", s_name);
641 FAT_DPRINT (", start: 0x%x", START (dentptr));
642 FAT_DPRINT (", size: 0x%x %s\n",
643 FAT2CPU32 (dentptr->size),
644 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
648 curclust = get_fatent (mydata, curclust);
649 if (curclust <= 0x0001 || curclust >= 0xfff0) {
650 FAT_DPRINT ("curclust: 0x%x\n", curclust);
651 FAT_ERROR ("Invalid FAT entry\n");
661 * Read boot sector and volume info from a FAT filesystem
664 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
666 __u8 block[FS_BLOCK_SIZE];
667 volume_info *vistart;
669 if (disk_read(0, 1, block) < 0) {
670 FAT_DPRINT("Error: reading block\n");
674 memcpy(bs, block, sizeof(boot_sector));
675 bs->reserved = FAT2CPU16(bs->reserved);
676 bs->fat_length = FAT2CPU16(bs->fat_length);
677 bs->secs_track = FAT2CPU16(bs->secs_track);
678 bs->heads = FAT2CPU16(bs->heads);
680 bs->hidden = FAT2CPU32(bs->hidden);
682 bs->total_sect = FAT2CPU32(bs->total_sect);
685 if (bs->fat_length == 0) {
687 bs->fat32_length = FAT2CPU32(bs->fat32_length);
688 bs->flags = FAT2CPU16(bs->flags);
689 bs->root_cluster = FAT2CPU32(bs->root_cluster);
690 bs->info_sector = FAT2CPU16(bs->info_sector);
691 bs->backup_boot = FAT2CPU16(bs->backup_boot);
692 vistart = (volume_info*) (block + sizeof(boot_sector));
695 vistart = (volume_info*) &(bs->fat32_length);
698 memcpy(volinfo, vistart, sizeof(volume_info));
700 /* Terminate fs_type string. Writing past the end of vistart
701 is ok - it's just the buffer. */
702 vistart->fs_type[8] = '\0';
704 if (*fatsize == 32) {
705 if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
709 if (compare_sign(FAT12_SIGN, vistart->fs_type) == 0) {
713 if (compare_sign(FAT16_SIGN, vistart->fs_type) == 0) {
719 FAT_DPRINT("Error: broken fs_type sign\n");
724 __u8 do_fat_read_block[MAX_CLUSTSIZE]; /* Block buffer */
726 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
729 #if CONFIG_NIOS /* NIOS CPU cannot access big automatic arrays */
732 char fnamecopy[2048];
736 fsdata *mydata = &datablock;
738 __u16 prevcksum = 0xffff;
740 int rootdir_size, cursect;
742 int files = 0, dirs = 0;
746 if (read_bootsectandvi (&bs, &volinfo, &mydata->fatsize)) {
747 FAT_DPRINT ("Error: reading boot sector\n");
750 if (mydata->fatsize == 32) {
751 mydata->fatlength = bs.fat32_length;
753 mydata->fatlength = bs.fat_length;
755 mydata->fat_sect = bs.reserved;
756 cursect = mydata->rootdir_sect
757 = mydata->fat_sect + mydata->fatlength * bs.fats;
758 mydata->clust_size = bs.cluster_size;
759 if (mydata->fatsize == 32) {
760 rootdir_size = mydata->clust_size;
761 mydata->data_begin = mydata->rootdir_sect /* + rootdir_size */
762 - (mydata->clust_size * 2);
764 rootdir_size = ((bs.dir_entries[1] * (int) 256 + bs.dir_entries[0])
765 * sizeof (dir_entry)) / SECTOR_SIZE;
766 mydata->data_begin = mydata->rootdir_sect + rootdir_size
767 - (mydata->clust_size * 2);
769 mydata->fatbufnum = -1;
771 FAT_DPRINT ("FAT%d, fatlength: %d\n", mydata->fatsize,
773 FAT_DPRINT ("Rootdir begins at sector: %d, offset: %x, size: %d\n"
774 "Data begins at: %d\n",
775 mydata->rootdir_sect, mydata->rootdir_sect * SECTOR_SIZE,
776 rootdir_size, mydata->data_begin);
777 FAT_DPRINT ("Cluster size: %d\n", mydata->clust_size);
779 /* "cwd" is always the root... */
780 while (ISDIRDELIM (*filename))
782 /* Make a copy of the filename and convert it to lowercase */
783 strcpy (fnamecopy, filename);
784 downcase (fnamecopy);
785 if (*fnamecopy == '\0') {
789 } else if ((idx = dirdelim (fnamecopy)) >= 0) {
791 fnamecopy[idx] = '\0';
792 subname = fnamecopy + idx + 1;
793 /* Handle multiple delimiters */
794 while (ISDIRDELIM (*subname))
803 if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
804 FAT_DPRINT ("Error: reading rootdir block\n");
807 dentptr = (dir_entry *) do_fat_read_block;
808 for (i = 0; i < DIRENTSPERBLOCK; i++) {
809 char s_name[14], l_name[256];
812 if ((dentptr->attr & ATTR_VOLUME)) {
813 #ifdef CONFIG_SUPPORT_VFAT
814 if ((dentptr->attr & ATTR_VFAT) &&
815 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
816 prevcksum = ((dir_slot *) dentptr)->alias_checksum;
817 get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
818 if (dols == LS_ROOT) {
819 int isdir = (dentptr->attr & ATTR_DIR);
829 if (l_name[0] != 0) {
836 printf (" %8ld %s%c\n",
837 (long) FAT2CPU32 (dentptr->size),
840 printf (" %s%c\n", l_name, dirc);
846 FAT_DPRINT ("Rootvfatname: |%s|\n", l_name);
850 /* Volume label or VFAT entry */
854 } else if (dentptr->name[0] == 0) {
855 FAT_DPRINT ("RootDentname == NULL - %d\n", i);
856 if (dols == LS_ROOT) {
857 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
862 #ifdef CONFIG_SUPPORT_VFAT
863 else if (dols == LS_ROOT
864 && mkcksum (dentptr->name) == prevcksum) {
869 get_name (dentptr, s_name);
870 if (dols == LS_ROOT) {
871 int isdir = (dentptr->attr & ATTR_DIR);
877 if (s_name[0] != 0) {
883 if (s_name[0] != 0) {
890 printf (" %8ld %s%c\n",
891 (long) FAT2CPU32 (dentptr->size), s_name,
894 printf (" %s%c\n", s_name, dirc);
900 if (strcmp (fnamecopy, s_name) && strcmp (fnamecopy, l_name)) {
901 FAT_DPRINT ("RootMismatch: |%s|%s|\n", s_name, l_name);
905 if (isdir && !(dentptr->attr & ATTR_DIR))
908 FAT_DPRINT ("RootName: %s", s_name);
909 FAT_DPRINT (", start: 0x%x", START (dentptr));
910 FAT_DPRINT (", size: 0x%x %s\n",
911 FAT2CPU32 (dentptr->size), isdir ? "(DIR)" : "");
913 goto rootdir_done; /* We got a match */
921 int startsect = mydata->data_begin
922 + START (dentptr) * mydata->clust_size;
924 char *nextname = NULL;
929 idx = dirdelim (subname);
932 nextname = subname + idx + 1;
933 /* Handle multiple delimiters */
934 while (ISDIRDELIM (*nextname))
936 if (dols && *nextname == '\0')
939 if (dols && firsttime) {
946 if (get_dentfromdir (mydata, startsect, subname, dentptr,
947 isdir ? 0 : dols) == NULL) {
954 if (!(dentptr->attr & ATTR_DIR))
959 ret = get_contents (mydata, dentptr, buffer, maxsize);
960 FAT_DPRINT ("Size: %d, got: %ld\n", FAT2CPU32 (dentptr->size), ret);
967 file_fat_detectfs(void)
975 printf("No current device\n");
978 #if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
979 (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_MMC)
980 printf("Interface: ");
981 switch(cur_dev->if_type) {
982 case IF_TYPE_IDE : printf("IDE"); break;
983 case IF_TYPE_SCSI : printf("SCSI"); break;
984 case IF_TYPE_ATAPI : printf("ATAPI"); break;
985 case IF_TYPE_USB : printf("USB"); break;
986 case IF_TYPE_DOC : printf("DOC"); break;
987 case IF_TYPE_MMC : printf("MMC"); break;
988 default : printf("Unknown");
990 printf("\n Device %d: ",cur_dev->dev);
993 if(read_bootsectandvi(&bs, &volinfo, &fatsize)) {
994 printf("\nNo valid FAT fs found\n");
997 memcpy (vol_label, volinfo.volume_label, 11);
998 vol_label[11] = '\0';
999 volinfo.fs_type[5]='\0';
1000 printf("Partition %d: Filesystem: %s \"%s\"\n"
1001 ,cur_part,volinfo.fs_type,vol_label);
1007 file_fat_ls(const char *dir)
1009 return do_fat_read(dir, NULL, 0, LS_YES);
1014 file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
1016 printf("reading %s\n",filename);
1017 return do_fat_read(filename, buffer, maxsize, LS_NO);
1020 #endif /* #if (CONFIG_COMMANDS & CFG_CMD_FAT) */