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];
73 disk_partition_t info;
75 if (!dev_desc->block_read)
78 /* check if we have a MBR (on floppies we have only a PBR) */
79 if (dev_desc->block_read (dev_desc->dev, 0, 1, (ulong *) buffer) != 1) {
80 printf ("** Can't read from device %d **\n", dev_desc->dev);
83 if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
84 buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
85 /* no signature found */
88 #if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \
89 (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
90 (CONFIG_COMMANDS & CFG_CMD_USB) || \
91 (defined(CONFIG_MMC)) || \
92 defined(CONFIG_SYSTEMACE) )
93 /* First we assume, there is a MBR */
94 if (!get_partition_info (dev_desc, part_no, &info)) {
95 part_offset = info.start;
97 } else if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3)) {
98 /* ok, we assume we are on a PBR only */
102 printf ("** Partition %d not valid on device %d **\n", part_no, dev_desc->dev);
106 if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
107 /* ok, we assume we are on a PBR only */
110 info.start = part_offset;
112 /* FIXME we need to determine the start block of the
113 * partition where the DOS FS resides. This can be done
114 * by using the get_partition_info routine. For this
115 * purpose the libpart must be included.
126 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
127 * Return index into string if found, -1 otherwise.
134 while (*str != '\0') {
135 if (ISDIRDELIM(*str)) return str - start;
143 * Match volume_info fs_type strings.
144 * Return 0 on match, -1 otherwise.
147 compare_sign(char *str1, char *str2)
149 char *end = str1+SIGNLEN;
151 while (str1 != end) {
152 if (*str1 != *str2) {
164 * Extract zero terminated short name from a directory entry.
166 static void get_name (dir_entry *dirent, char *s_name)
170 memcpy (s_name, dirent->name, 8);
173 while (*ptr && *ptr != ' ')
175 if (dirent->ext[0] && dirent->ext[0] != ' ') {
178 memcpy (ptr, dirent->ext, 3);
180 while (*ptr && *ptr != ' ')
184 if (*s_name == DELETED_FLAG)
186 else if (*s_name == aRING)
192 * Get the entry at index 'entry' in a FAT (12/16/32) table.
193 * On failure 0x00 is returned.
196 get_fatent(fsdata *mydata, __u32 entry)
202 switch (mydata->fatsize) {
204 bufnum = entry / FAT32BUFSIZE;
205 offset = entry - bufnum * FAT32BUFSIZE;
208 bufnum = entry / FAT16BUFSIZE;
209 offset = entry - bufnum * FAT16BUFSIZE;
212 bufnum = entry / FAT12BUFSIZE;
213 offset = entry - bufnum * FAT12BUFSIZE;
217 /* Unsupported FAT size */
221 /* Read a new block of FAT entries into the cache. */
222 if (bufnum != mydata->fatbufnum) {
223 int getsize = FATBUFSIZE/FS_BLOCK_SIZE;
224 __u8 *bufptr = mydata->fatbuf;
225 __u32 fatlength = mydata->fatlength;
226 __u32 startblock = bufnum * FATBUFBLOCKS;
228 fatlength *= SECTOR_SIZE; /* We want it in bytes now */
229 startblock += mydata->fat_sect; /* Offset from start of disk */
231 if (getsize > fatlength) getsize = fatlength;
232 if (disk_read(startblock, getsize, bufptr) < 0) {
233 FAT_DPRINT("Error reading FAT blocks\n");
236 mydata->fatbufnum = bufnum;
239 /* Get the actual entry from the table */
240 switch (mydata->fatsize) {
242 ret = FAT2CPU32(((__u32*)mydata->fatbuf)[offset]);
245 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[offset]);
248 __u32 off16 = (offset*3)/4;
251 switch (offset & 0x3) {
253 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
257 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
259 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
261 ret = (val2 << 4) | (val1 >> 12);
264 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
266 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
268 ret = (val2 << 8) | (val1 >> 8);
271 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);;
272 ret = (ret & 0xfff0) >> 4;
280 FAT_DPRINT("ret: %d, offset: %d\n", ret, offset);
287 * Read at most 'size' bytes from the specified cluster into 'buffer'.
288 * Return 0 on success, -1 otherwise.
291 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
297 startsect = mydata->data_begin + clustnum*mydata->clust_size;
299 startsect = mydata->rootdir_sect;
302 FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
303 if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
304 FAT_DPRINT("Error reading data\n");
307 if(size % FS_BLOCK_SIZE) {
308 __u8 tmpbuf[FS_BLOCK_SIZE];
309 idx= size/FS_BLOCK_SIZE;
310 if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
311 FAT_DPRINT("Error reading data\n");
314 buffer += idx*FS_BLOCK_SIZE;
316 memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
325 * Read at most 'maxsize' bytes from the file associated with 'dentptr'
327 * Return the number of bytes read or -1 on fatal errors.
330 get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
331 unsigned long maxsize)
333 unsigned long filesize = FAT2CPU32(dentptr->size), gotsize = 0;
334 unsigned int bytesperclust = mydata->clust_size * SECTOR_SIZE;
335 __u32 curclust = START(dentptr);
336 __u32 endclust, newclust;
337 unsigned long actsize;
339 FAT_DPRINT("Filesize: %ld bytes\n", filesize);
341 if (maxsize > 0 && filesize > maxsize) filesize = maxsize;
343 FAT_DPRINT("Reading: %ld bytes\n", filesize);
345 actsize=bytesperclust;
348 /* search for consecutive clusters */
349 while(actsize < filesize) {
350 newclust = get_fatent(mydata, endclust);
351 if((newclust -1)!=endclust)
353 if (newclust <= 0x0001 || newclust >= 0xfff0) {
354 FAT_DPRINT("curclust: 0x%x\n", newclust);
355 FAT_DPRINT("Invalid FAT entry\n");
359 actsize+= bytesperclust;
361 /* actsize >= file size */
362 actsize -= bytesperclust;
363 /* get remaining clusters */
364 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
365 FAT_ERROR("Error reading cluster\n");
368 /* get remaining bytes */
369 gotsize += (int)actsize;
373 if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
374 FAT_ERROR("Error reading cluster\n");
380 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
381 FAT_ERROR("Error reading cluster\n");
384 gotsize += (int)actsize;
387 curclust = get_fatent(mydata, endclust);
388 if (curclust <= 0x0001 || curclust >= 0xfff0) {
389 FAT_DPRINT("curclust: 0x%x\n", curclust);
390 FAT_ERROR("Invalid FAT entry\n");
393 actsize=bytesperclust;
399 #ifdef CONFIG_SUPPORT_VFAT
401 * Extract the file name information from 'slotptr' into 'l_name',
402 * starting at l_name[*idx].
403 * Return 1 if terminator (zero byte) is found, 0 otherwise.
406 slot2str(dir_slot *slotptr, char *l_name, int *idx)
410 for (j = 0; j <= 8; j += 2) {
411 l_name[*idx] = slotptr->name0_4[j];
412 if (l_name[*idx] == 0x00) return 1;
415 for (j = 0; j <= 10; j += 2) {
416 l_name[*idx] = slotptr->name5_10[j];
417 if (l_name[*idx] == 0x00) return 1;
420 for (j = 0; j <= 2; j += 2) {
421 l_name[*idx] = slotptr->name11_12[j];
422 if (l_name[*idx] == 0x00) return 1;
431 * Extract the full long filename starting at 'retdent' (which is really
432 * a slot) into 'l_name'. If successful also copy the real directory entry
434 * Return 0 on success, -1 otherwise.
436 __u8 get_vfatname_block[MAX_CLUSTSIZE];
438 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
439 dir_entry *retdent, char *l_name)
442 dir_slot *slotptr = (dir_slot*) retdent;
443 __u8 *nextclust = cluster + mydata->clust_size * SECTOR_SIZE;
444 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
447 while ((__u8*)slotptr < nextclust) {
448 if (counter == 0) break;
449 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
455 if ((__u8*)slotptr >= nextclust) {
459 curclust = get_fatent(mydata, curclust);
460 if (curclust <= 0x0001 || curclust >= 0xfff0) {
461 FAT_DPRINT("curclust: 0x%x\n", curclust);
462 FAT_ERROR("Invalid FAT entry\n");
465 if (get_cluster(mydata, curclust, get_vfatname_block,
466 mydata->clust_size * SECTOR_SIZE) != 0) {
467 FAT_DPRINT("Error: reading directory block\n");
470 slotptr2 = (dir_slot*) get_vfatname_block;
471 while (slotptr2->id > 0x01) {
474 /* Save the real directory entry */
475 realdent = (dir_entry*)slotptr2 + 1;
476 while ((__u8*)slotptr2 >= get_vfatname_block) {
477 slot2str(slotptr2, l_name, &idx);
481 /* Save the real directory entry */
482 realdent = (dir_entry*)slotptr;
487 if (slot2str(slotptr, l_name, &idx)) break;
488 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
491 if (*l_name == DELETED_FLAG) *l_name = '\0';
492 else if (*l_name == aRING) *l_name = 'å';
495 /* Return the real directory entry */
496 memcpy(retdent, realdent, sizeof(dir_entry));
502 /* Calculate short name checksum */
504 mkcksum(const char *str)
509 for (i = 0; i < 11; i++) {
510 ret = (((ret&1)<<7)|((ret&0xfe)>>1)) + str[i];
519 * Get the directory entry associated with 'filename' from the directory
520 * starting at 'startsect'
522 __u8 get_dentfromdir_block[MAX_CLUSTSIZE];
523 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
524 char *filename, dir_entry * retdent,
527 __u16 prevcksum = 0xffff;
528 __u32 curclust = START (retdent);
529 int files = 0, dirs = 0;
531 FAT_DPRINT ("get_dentfromdir: %s\n", filename);
536 if (get_cluster (mydata, curclust, get_dentfromdir_block,
537 mydata->clust_size * SECTOR_SIZE) != 0) {
538 FAT_DPRINT ("Error: reading directory block\n");
541 dentptr = (dir_entry *) get_dentfromdir_block;
542 for (i = 0; i < DIRENTSPERCLUST; i++) {
543 char s_name[14], l_name[256];
546 if (dentptr->name[0] == DELETED_FLAG) {
550 if ((dentptr->attr & ATTR_VOLUME)) {
551 #ifdef CONFIG_SUPPORT_VFAT
552 if ((dentptr->attr & ATTR_VFAT) &&
553 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
554 prevcksum = ((dir_slot *) dentptr)
556 get_vfatname (mydata, curclust, get_dentfromdir_block,
559 int isdir = (dentptr->attr & ATTR_DIR);
569 if (l_name[0] != 0) {
576 printf (" %8ld %s%c\n",
577 (long) FAT2CPU32 (dentptr->size),
580 printf (" %s%c\n", l_name, dirc);
586 FAT_DPRINT ("vfatname: |%s|\n", l_name);
590 /* Volume label or VFAT entry */
595 if (dentptr->name[0] == 0) {
597 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
599 FAT_DPRINT ("Dentname == NULL - %d\n", i);
602 #ifdef CONFIG_SUPPORT_VFAT
603 if (dols && mkcksum (dentptr->name) == prevcksum) {
608 get_name (dentptr, s_name);
610 int isdir = (dentptr->attr & ATTR_DIR);
620 if (s_name[0] != 0) {
627 printf (" %8ld %s%c\n",
628 (long) FAT2CPU32 (dentptr->size), s_name,
631 printf (" %s%c\n", s_name, dirc);
637 if (strcmp (filename, s_name) && strcmp (filename, l_name)) {
638 FAT_DPRINT ("Mismatch: |%s|%s|\n", s_name, l_name);
642 memcpy (retdent, dentptr, sizeof (dir_entry));
644 FAT_DPRINT ("DentName: %s", s_name);
645 FAT_DPRINT (", start: 0x%x", START (dentptr));
646 FAT_DPRINT (", size: 0x%x %s\n",
647 FAT2CPU32 (dentptr->size),
648 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
652 curclust = get_fatent (mydata, curclust);
653 if (curclust <= 0x0001 || curclust >= 0xfff0) {
654 FAT_DPRINT ("curclust: 0x%x\n", curclust);
655 FAT_ERROR ("Invalid FAT entry\n");
665 * Read boot sector and volume info from a FAT filesystem
668 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
670 __u8 block[FS_BLOCK_SIZE];
671 volume_info *vistart;
673 if (disk_read(0, 1, block) < 0) {
674 FAT_DPRINT("Error: reading block\n");
678 memcpy(bs, block, sizeof(boot_sector));
679 bs->reserved = FAT2CPU16(bs->reserved);
680 bs->fat_length = FAT2CPU16(bs->fat_length);
681 bs->secs_track = FAT2CPU16(bs->secs_track);
682 bs->heads = FAT2CPU16(bs->heads);
684 bs->hidden = FAT2CPU32(bs->hidden);
686 bs->total_sect = FAT2CPU32(bs->total_sect);
689 if (bs->fat_length == 0) {
691 bs->fat32_length = FAT2CPU32(bs->fat32_length);
692 bs->flags = FAT2CPU16(bs->flags);
693 bs->root_cluster = FAT2CPU32(bs->root_cluster);
694 bs->info_sector = FAT2CPU16(bs->info_sector);
695 bs->backup_boot = FAT2CPU16(bs->backup_boot);
696 vistart = (volume_info*) (block + sizeof(boot_sector));
699 vistart = (volume_info*) &(bs->fat32_length);
702 memcpy(volinfo, vistart, sizeof(volume_info));
704 /* Terminate fs_type string. Writing past the end of vistart
705 is ok - it's just the buffer. */
706 vistart->fs_type[8] = '\0';
708 if (*fatsize == 32) {
709 if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
713 if (compare_sign(FAT12_SIGN, vistart->fs_type) == 0) {
717 if (compare_sign(FAT16_SIGN, vistart->fs_type) == 0) {
723 FAT_DPRINT("Error: broken fs_type sign\n");
728 __u8 do_fat_read_block[MAX_CLUSTSIZE]; /* Block buffer */
730 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
733 #if CONFIG_NIOS /* NIOS CPU cannot access big automatic arrays */
736 char fnamecopy[2048];
740 fsdata *mydata = &datablock;
742 __u16 prevcksum = 0xffff;
744 int rootdir_size, cursect;
746 int files = 0, dirs = 0;
750 if (read_bootsectandvi (&bs, &volinfo, &mydata->fatsize)) {
751 FAT_DPRINT ("Error: reading boot sector\n");
754 if (mydata->fatsize == 32) {
755 mydata->fatlength = bs.fat32_length;
757 mydata->fatlength = bs.fat_length;
759 mydata->fat_sect = bs.reserved;
760 cursect = mydata->rootdir_sect
761 = mydata->fat_sect + mydata->fatlength * bs.fats;
762 mydata->clust_size = bs.cluster_size;
763 if (mydata->fatsize == 32) {
764 rootdir_size = mydata->clust_size;
765 mydata->data_begin = mydata->rootdir_sect /* + rootdir_size */
766 - (mydata->clust_size * 2);
768 rootdir_size = ((bs.dir_entries[1] * (int) 256 + bs.dir_entries[0])
769 * sizeof (dir_entry)) / SECTOR_SIZE;
770 mydata->data_begin = mydata->rootdir_sect + rootdir_size
771 - (mydata->clust_size * 2);
773 mydata->fatbufnum = -1;
775 FAT_DPRINT ("FAT%d, fatlength: %d\n", mydata->fatsize,
777 FAT_DPRINT ("Rootdir begins at sector: %d, offset: %x, size: %d\n"
778 "Data begins at: %d\n",
779 mydata->rootdir_sect, mydata->rootdir_sect * SECTOR_SIZE,
780 rootdir_size, mydata->data_begin);
781 FAT_DPRINT ("Cluster size: %d\n", mydata->clust_size);
783 /* "cwd" is always the root... */
784 while (ISDIRDELIM (*filename))
786 /* Make a copy of the filename and convert it to lowercase */
787 strcpy (fnamecopy, filename);
788 downcase (fnamecopy);
789 if (*fnamecopy == '\0') {
793 } else if ((idx = dirdelim (fnamecopy)) >= 0) {
795 fnamecopy[idx] = '\0';
796 subname = fnamecopy + idx + 1;
797 /* Handle multiple delimiters */
798 while (ISDIRDELIM (*subname))
807 if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
808 FAT_DPRINT ("Error: reading rootdir block\n");
811 dentptr = (dir_entry *) do_fat_read_block;
812 for (i = 0; i < DIRENTSPERBLOCK; i++) {
813 char s_name[14], l_name[256];
816 if ((dentptr->attr & ATTR_VOLUME)) {
817 #ifdef CONFIG_SUPPORT_VFAT
818 if ((dentptr->attr & ATTR_VFAT) &&
819 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
820 prevcksum = ((dir_slot *) dentptr)->alias_checksum;
821 get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
822 if (dols == LS_ROOT) {
823 int isdir = (dentptr->attr & ATTR_DIR);
833 if (l_name[0] != 0) {
840 printf (" %8ld %s%c\n",
841 (long) FAT2CPU32 (dentptr->size),
844 printf (" %s%c\n", l_name, dirc);
850 FAT_DPRINT ("Rootvfatname: |%s|\n", l_name);
854 /* Volume label or VFAT entry */
858 } else if (dentptr->name[0] == 0) {
859 FAT_DPRINT ("RootDentname == NULL - %d\n", i);
860 if (dols == LS_ROOT) {
861 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
866 #ifdef CONFIG_SUPPORT_VFAT
867 else if (dols == LS_ROOT
868 && mkcksum (dentptr->name) == prevcksum) {
873 get_name (dentptr, s_name);
874 if (dols == LS_ROOT) {
875 int isdir = (dentptr->attr & ATTR_DIR);
881 if (s_name[0] != 0) {
887 if (s_name[0] != 0) {
894 printf (" %8ld %s%c\n",
895 (long) FAT2CPU32 (dentptr->size), s_name,
898 printf (" %s%c\n", s_name, dirc);
904 if (strcmp (fnamecopy, s_name) && strcmp (fnamecopy, l_name)) {
905 FAT_DPRINT ("RootMismatch: |%s|%s|\n", s_name, l_name);
909 if (isdir && !(dentptr->attr & ATTR_DIR))
912 FAT_DPRINT ("RootName: %s", s_name);
913 FAT_DPRINT (", start: 0x%x", START (dentptr));
914 FAT_DPRINT (", size: 0x%x %s\n",
915 FAT2CPU32 (dentptr->size), isdir ? "(DIR)" : "");
917 goto rootdir_done; /* We got a match */
925 int startsect = mydata->data_begin
926 + START (dentptr) * mydata->clust_size;
928 char *nextname = NULL;
933 idx = dirdelim (subname);
936 nextname = subname + idx + 1;
937 /* Handle multiple delimiters */
938 while (ISDIRDELIM (*nextname))
940 if (dols && *nextname == '\0')
943 if (dols && firsttime) {
950 if (get_dentfromdir (mydata, startsect, subname, dentptr,
951 isdir ? 0 : dols) == NULL) {
958 if (!(dentptr->attr & ATTR_DIR))
963 ret = get_contents (mydata, dentptr, buffer, maxsize);
964 FAT_DPRINT ("Size: %d, got: %ld\n", FAT2CPU32 (dentptr->size), ret);
971 file_fat_detectfs(void)
979 printf("No current device\n");
982 #if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
983 (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_MMC)
984 printf("Interface: ");
985 switch(cur_dev->if_type) {
986 case IF_TYPE_IDE : printf("IDE"); break;
987 case IF_TYPE_SCSI : printf("SCSI"); break;
988 case IF_TYPE_ATAPI : printf("ATAPI"); break;
989 case IF_TYPE_USB : printf("USB"); break;
990 case IF_TYPE_DOC : printf("DOC"); break;
991 case IF_TYPE_MMC : printf("MMC"); break;
992 default : printf("Unknown");
994 printf("\n Device %d: ",cur_dev->dev);
997 if(read_bootsectandvi(&bs, &volinfo, &fatsize)) {
998 printf("\nNo valid FAT fs found\n");
1001 memcpy (vol_label, volinfo.volume_label, 11);
1002 vol_label[11] = '\0';
1003 volinfo.fs_type[5]='\0';
1004 printf("Partition %d: Filesystem: %s \"%s\"\n"
1005 ,cur_part,volinfo.fs_type,vol_label);
1011 file_fat_ls(const char *dir)
1013 return do_fat_read(dir, NULL, 0, LS_YES);
1018 file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
1020 printf("reading %s\n",filename);
1021 return do_fat_read(filename, buffer, maxsize, LS_NO);
1024 #endif /* #if (CONFIG_COMMANDS & CFG_CMD_FAT) */