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) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
93 (CONFIG_COMMANDS & CFG_CMD_USB) || defined(CONFIG_SYSTEMACE)
94 disk_partition_t info;
95 if(!get_partition_info(dev_desc, part_no, &info)) {
96 part_offset = info.start;
100 printf ("** Partition %d not valid on device %d **\n",part_no,dev_desc->dev);
104 /* FIXME we need to determine the start block of the
105 * partition where the DOS FS resides. This can be done
106 * by using the get_partition_info routine. For this
107 * purpose the libpart must be included.
118 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
119 * Return index into string if found, -1 otherwise.
126 while (*str != '\0') {
127 if (ISDIRDELIM(*str)) return str - start;
135 * Match volume_info fs_type strings.
136 * Return 0 on match, -1 otherwise.
139 compare_sign(char *str1, char *str2)
141 char *end = str1+SIGNLEN;
143 while (str1 != end) {
144 if (*str1 != *str2) {
156 * Extract zero terminated short name from a directory entry.
158 static void get_name (dir_entry *dirent, char *s_name)
162 memcpy (s_name, dirent->name, 8);
165 while (*ptr && *ptr != ' ')
167 if (dirent->ext[0] && dirent->ext[0] != ' ') {
170 memcpy (ptr, dirent->ext, 3);
172 while (*ptr && *ptr != ' ')
176 if (*s_name == DELETED_FLAG)
178 else if (*s_name == aRING)
184 * Get the entry at index 'entry' in a FAT (12/16/32) table.
185 * On failure 0x00 is returned.
188 get_fatent(fsdata *mydata, __u32 entry)
194 switch (mydata->fatsize) {
196 bufnum = entry / FAT32BUFSIZE;
197 offset = entry - bufnum * FAT32BUFSIZE;
200 bufnum = entry / FAT16BUFSIZE;
201 offset = entry - bufnum * FAT16BUFSIZE;
204 bufnum = entry / FAT12BUFSIZE;
205 offset = entry - bufnum * FAT12BUFSIZE;
209 /* Unsupported FAT size */
213 /* Read a new block of FAT entries into the cache. */
214 if (bufnum != mydata->fatbufnum) {
215 int getsize = FATBUFSIZE/FS_BLOCK_SIZE;
216 __u8 *bufptr = mydata->fatbuf;
217 __u32 fatlength = mydata->fatlength;
218 __u32 startblock = bufnum * FATBUFBLOCKS;
220 fatlength *= SECTOR_SIZE; /* We want it in bytes now */
221 startblock += mydata->fat_sect; /* Offset from start of disk */
223 if (getsize > fatlength) getsize = fatlength;
224 if (disk_read(startblock, getsize, bufptr) < 0) {
225 FAT_DPRINT("Error reading FAT blocks\n");
228 mydata->fatbufnum = bufnum;
231 /* Get the actual entry from the table */
232 switch (mydata->fatsize) {
234 ret = FAT2CPU32(((__u32*)mydata->fatbuf)[offset]);
237 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[offset]);
240 __u32 off16 = (offset*3)/4;
243 switch (offset & 0x3) {
245 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
249 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
251 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
253 ret = (val2 << 4) | (val1 >> 12);
256 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
258 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
260 ret = (val2 << 8) | (val1 >> 8);
263 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);;
264 ret = (ret & 0xfff0) >> 4;
272 FAT_DPRINT("ret: %d, offset: %d\n", ret, offset);
279 * Read at most 'size' bytes from the specified cluster into 'buffer'.
280 * Return 0 on success, -1 otherwise.
283 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
289 startsect = mydata->data_begin + clustnum*mydata->clust_size;
291 startsect = mydata->rootdir_sect;
294 FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
295 if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
296 FAT_DPRINT("Error reading data\n");
299 if(size % FS_BLOCK_SIZE) {
300 __u8 tmpbuf[FS_BLOCK_SIZE];
301 idx= size/FS_BLOCK_SIZE;
302 if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
303 FAT_DPRINT("Error reading data\n");
306 buffer += idx*FS_BLOCK_SIZE;
308 memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
317 * Read at most 'maxsize' bytes from the file associated with 'dentptr'
319 * Return the number of bytes read or -1 on fatal errors.
322 get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
323 unsigned long maxsize)
325 unsigned long filesize = FAT2CPU32(dentptr->size), gotsize = 0;
326 unsigned int bytesperclust = mydata->clust_size * SECTOR_SIZE;
327 __u32 curclust = START(dentptr);
328 __u32 endclust, newclust;
329 unsigned long actsize;
331 FAT_DPRINT("Filesize: %ld bytes\n", filesize);
333 if (maxsize > 0 && filesize > maxsize) filesize = maxsize;
335 FAT_DPRINT("Reading: %ld bytes\n", filesize);
337 actsize=bytesperclust;
340 /* search for consecutive clusters */
341 while(actsize < filesize) {
342 newclust = get_fatent(mydata, endclust);
343 if((newclust -1)!=endclust)
345 if (newclust <= 0x0001 || newclust >= 0xfff0) {
346 FAT_DPRINT("curclust: 0x%x\n", newclust);
347 FAT_DPRINT("Invalid FAT entry\n");
351 actsize+= bytesperclust;
353 /* actsize >= file size */
354 actsize -= bytesperclust;
355 /* get remaining clusters */
356 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
357 FAT_ERROR("Error reading cluster\n");
360 /* get remaining bytes */
361 gotsize += (int)actsize;
365 if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
366 FAT_ERROR("Error reading cluster\n");
372 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
373 FAT_ERROR("Error reading cluster\n");
376 gotsize += (int)actsize;
379 curclust = get_fatent(mydata, endclust);
380 if (curclust <= 0x0001 || curclust >= 0xfff0) {
381 FAT_DPRINT("curclust: 0x%x\n", curclust);
382 FAT_ERROR("Invalid FAT entry\n");
385 actsize=bytesperclust;
391 #ifdef CONFIG_SUPPORT_VFAT
393 * Extract the file name information from 'slotptr' into 'l_name',
394 * starting at l_name[*idx].
395 * Return 1 if terminator (zero byte) is found, 0 otherwise.
398 slot2str(dir_slot *slotptr, char *l_name, int *idx)
402 for (j = 0; j <= 8; j += 2) {
403 l_name[*idx] = slotptr->name0_4[j];
404 if (l_name[*idx] == 0x00) return 1;
407 for (j = 0; j <= 10; j += 2) {
408 l_name[*idx] = slotptr->name5_10[j];
409 if (l_name[*idx] == 0x00) return 1;
412 for (j = 0; j <= 2; j += 2) {
413 l_name[*idx] = slotptr->name11_12[j];
414 if (l_name[*idx] == 0x00) return 1;
423 * Extract the full long filename starting at 'retdent' (which is really
424 * a slot) into 'l_name'. If successful also copy the real directory entry
426 * Return 0 on success, -1 otherwise.
428 __u8 get_vfatname_block[MAX_CLUSTSIZE];
430 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
431 dir_entry *retdent, char *l_name)
434 dir_slot *slotptr = (dir_slot*) retdent;
435 __u8 *nextclust = cluster + mydata->clust_size * SECTOR_SIZE;
436 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
439 while ((__u8*)slotptr < nextclust) {
440 if (counter == 0) break;
441 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
447 if ((__u8*)slotptr >= nextclust) {
451 curclust = get_fatent(mydata, curclust);
452 if (curclust <= 0x0001 || curclust >= 0xfff0) {
453 FAT_DPRINT("curclust: 0x%x\n", curclust);
454 FAT_ERROR("Invalid FAT entry\n");
457 if (get_cluster(mydata, curclust, get_vfatname_block,
458 mydata->clust_size * SECTOR_SIZE) != 0) {
459 FAT_DPRINT("Error: reading directory block\n");
462 slotptr2 = (dir_slot*) get_vfatname_block;
463 while (slotptr2->id > 0x01) {
466 /* Save the real directory entry */
467 realdent = (dir_entry*)slotptr2 + 1;
468 while ((__u8*)slotptr2 >= get_vfatname_block) {
469 slot2str(slotptr2, l_name, &idx);
473 /* Save the real directory entry */
474 realdent = (dir_entry*)slotptr;
479 if (slot2str(slotptr, l_name, &idx)) break;
480 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
483 if (*l_name == DELETED_FLAG) *l_name = '\0';
484 else if (*l_name == aRING) *l_name = 'å';
487 /* Return the real directory entry */
488 memcpy(retdent, realdent, sizeof(dir_entry));
494 /* Calculate short name checksum */
496 mkcksum(const char *str)
501 for (i = 0; i < 11; i++) {
502 ret = (((ret&1)<<7)|((ret&0xfe)>>1)) + str[i];
511 * Get the directory entry associated with 'filename' from the directory
512 * starting at 'startsect'
514 __u8 get_dentfromdir_block[MAX_CLUSTSIZE];
515 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
516 char *filename, dir_entry * retdent,
519 __u16 prevcksum = 0xffff;
520 __u32 curclust = START (retdent);
521 int files = 0, dirs = 0;
523 FAT_DPRINT ("get_dentfromdir: %s\n", filename);
528 if (get_cluster (mydata, curclust, get_dentfromdir_block,
529 mydata->clust_size * SECTOR_SIZE) != 0) {
530 FAT_DPRINT ("Error: reading directory block\n");
533 dentptr = (dir_entry *) get_dentfromdir_block;
534 for (i = 0; i < DIRENTSPERCLUST; i++) {
535 char s_name[14], l_name[256];
538 if (dentptr->name[0] == DELETED_FLAG) {
542 if ((dentptr->attr & ATTR_VOLUME)) {
543 #ifdef CONFIG_SUPPORT_VFAT
544 if ((dentptr->attr & ATTR_VFAT) &&
545 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
546 prevcksum = ((dir_slot *) dentptr)
548 get_vfatname (mydata, curclust, get_dentfromdir_block,
551 int isdir = (dentptr->attr & ATTR_DIR);
561 if (l_name[0] != 0) {
568 printf (" %8ld %s%c\n",
569 (long) FAT2CPU32 (dentptr->size),
572 printf (" %s%c\n", l_name, dirc);
578 FAT_DPRINT ("vfatname: |%s|\n", l_name);
582 /* Volume label or VFAT entry */
587 if (dentptr->name[0] == 0) {
589 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
591 FAT_DPRINT ("Dentname == NULL - %d\n", i);
594 #ifdef CONFIG_SUPPORT_VFAT
595 if (dols && mkcksum (dentptr->name) == prevcksum) {
600 get_name (dentptr, s_name);
602 int isdir = (dentptr->attr & ATTR_DIR);
612 if (s_name[0] != 0) {
619 printf (" %8ld %s%c\n",
620 (long) FAT2CPU32 (dentptr->size), s_name,
623 printf (" %s%c\n", s_name, dirc);
629 if (strcmp (filename, s_name) && strcmp (filename, l_name)) {
630 FAT_DPRINT ("Mismatch: |%s|%s|\n", s_name, l_name);
634 memcpy (retdent, dentptr, sizeof (dir_entry));
636 FAT_DPRINT ("DentName: %s", s_name);
637 FAT_DPRINT (", start: 0x%x", START (dentptr));
638 FAT_DPRINT (", size: 0x%x %s\n",
639 FAT2CPU32 (dentptr->size),
640 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
644 curclust = get_fatent (mydata, curclust);
645 if (curclust <= 0x0001 || curclust >= 0xfff0) {
646 FAT_DPRINT ("curclust: 0x%x\n", curclust);
647 FAT_ERROR ("Invalid FAT entry\n");
657 * Read boot sector and volume info from a FAT filesystem
660 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
662 __u8 block[FS_BLOCK_SIZE];
663 volume_info *vistart;
665 if (disk_read(0, 1, block) < 0) {
666 FAT_DPRINT("Error: reading block\n");
670 memcpy(bs, block, sizeof(boot_sector));
671 bs->reserved = FAT2CPU16(bs->reserved);
672 bs->fat_length = FAT2CPU16(bs->fat_length);
673 bs->secs_track = FAT2CPU16(bs->secs_track);
674 bs->heads = FAT2CPU16(bs->heads);
676 bs->hidden = FAT2CPU32(bs->hidden);
678 bs->total_sect = FAT2CPU32(bs->total_sect);
681 if (bs->fat_length == 0) {
683 bs->fat32_length = FAT2CPU32(bs->fat32_length);
684 bs->flags = FAT2CPU16(bs->flags);
685 bs->root_cluster = FAT2CPU32(bs->root_cluster);
686 bs->info_sector = FAT2CPU16(bs->info_sector);
687 bs->backup_boot = FAT2CPU16(bs->backup_boot);
688 vistart = (volume_info*) (block + sizeof(boot_sector));
691 vistart = (volume_info*) &(bs->fat32_length);
694 memcpy(volinfo, vistart, sizeof(volume_info));
696 /* Terminate fs_type string. Writing past the end of vistart
697 is ok - it's just the buffer. */
698 vistart->fs_type[8] = '\0';
700 if (*fatsize == 32) {
701 if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
705 if (compare_sign(FAT12_SIGN, vistart->fs_type) == 0) {
709 if (compare_sign(FAT16_SIGN, vistart->fs_type) == 0) {
715 FAT_DPRINT("Error: broken fs_type sign\n");
720 __u8 do_fat_read_block[MAX_CLUSTSIZE]; /* Block buffer */
722 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
725 #if CONFIG_NIOS /* NIOS CPU cannot access big automatic arrays */
728 char fnamecopy[2048];
732 fsdata *mydata = &datablock;
734 __u16 prevcksum = 0xffff;
736 int rootdir_size, cursect;
738 int files = 0, dirs = 0;
742 if (read_bootsectandvi (&bs, &volinfo, &mydata->fatsize)) {
743 FAT_DPRINT ("Error: reading boot sector\n");
746 if (mydata->fatsize == 32) {
747 mydata->fatlength = bs.fat32_length;
749 mydata->fatlength = bs.fat_length;
751 mydata->fat_sect = bs.reserved;
752 cursect = mydata->rootdir_sect
753 = mydata->fat_sect + mydata->fatlength * bs.fats;
754 mydata->clust_size = bs.cluster_size;
755 if (mydata->fatsize == 32) {
756 rootdir_size = mydata->clust_size;
757 mydata->data_begin = mydata->rootdir_sect /* + rootdir_size */
758 - (mydata->clust_size * 2);
760 rootdir_size = ((bs.dir_entries[1] * (int) 256 + bs.dir_entries[0])
761 * sizeof (dir_entry)) / SECTOR_SIZE;
762 mydata->data_begin = mydata->rootdir_sect + rootdir_size
763 - (mydata->clust_size * 2);
765 mydata->fatbufnum = -1;
767 FAT_DPRINT ("FAT%d, fatlength: %d\n", mydata->fatsize,
769 FAT_DPRINT ("Rootdir begins at sector: %d, offset: %x, size: %d\n"
770 "Data begins at: %d\n",
771 mydata->rootdir_sect, mydata->rootdir_sect * SECTOR_SIZE,
772 rootdir_size, mydata->data_begin);
773 FAT_DPRINT ("Cluster size: %d\n", mydata->clust_size);
775 /* "cwd" is always the root... */
776 while (ISDIRDELIM (*filename))
778 /* Make a copy of the filename and convert it to lowercase */
779 strcpy (fnamecopy, filename);
780 downcase (fnamecopy);
781 if (*fnamecopy == '\0') {
785 } else if ((idx = dirdelim (fnamecopy)) >= 0) {
787 fnamecopy[idx] = '\0';
788 subname = fnamecopy + idx + 1;
789 /* Handle multiple delimiters */
790 while (ISDIRDELIM (*subname))
799 if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
800 FAT_DPRINT ("Error: reading rootdir block\n");
803 dentptr = (dir_entry *) do_fat_read_block;
804 for (i = 0; i < DIRENTSPERBLOCK; i++) {
805 char s_name[14], l_name[256];
808 if ((dentptr->attr & ATTR_VOLUME)) {
809 #ifdef CONFIG_SUPPORT_VFAT
810 if ((dentptr->attr & ATTR_VFAT) &&
811 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
812 prevcksum = ((dir_slot *) dentptr)->alias_checksum;
813 get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
814 if (dols == LS_ROOT) {
815 int isdir = (dentptr->attr & ATTR_DIR);
825 if (l_name[0] != 0) {
832 printf (" %8ld %s%c\n",
833 (long) FAT2CPU32 (dentptr->size),
836 printf (" %s%c\n", l_name, dirc);
842 FAT_DPRINT ("Rootvfatname: |%s|\n", l_name);
846 /* Volume label or VFAT entry */
850 } else if (dentptr->name[0] == 0) {
851 FAT_DPRINT ("RootDentname == NULL - %d\n", i);
852 if (dols == LS_ROOT) {
853 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
858 #ifdef CONFIG_SUPPORT_VFAT
859 else if (dols == LS_ROOT
860 && mkcksum (dentptr->name) == prevcksum) {
865 get_name (dentptr, s_name);
866 if (dols == LS_ROOT) {
867 int isdir = (dentptr->attr & ATTR_DIR);
873 if (s_name[0] != 0) {
879 if (s_name[0] != 0) {
886 printf (" %8ld %s%c\n",
887 (long) FAT2CPU32 (dentptr->size), s_name,
890 printf (" %s%c\n", s_name, dirc);
896 if (strcmp (fnamecopy, s_name) && strcmp (fnamecopy, l_name)) {
897 FAT_DPRINT ("RootMismatch: |%s|%s|\n", s_name, l_name);
901 if (isdir && !(dentptr->attr & ATTR_DIR))
904 FAT_DPRINT ("RootName: %s", s_name);
905 FAT_DPRINT (", start: 0x%x", START (dentptr));
906 FAT_DPRINT (", size: 0x%x %s\n",
907 FAT2CPU32 (dentptr->size), isdir ? "(DIR)" : "");
909 goto rootdir_done; /* We got a match */
917 int startsect = mydata->data_begin
918 + START (dentptr) * mydata->clust_size;
920 char *nextname = NULL;
925 idx = dirdelim (subname);
928 nextname = subname + idx + 1;
929 /* Handle multiple delimiters */
930 while (ISDIRDELIM (*nextname))
932 if (dols && *nextname == '\0')
935 if (dols && firsttime) {
942 if (get_dentfromdir (mydata, startsect, subname, dentptr,
943 isdir ? 0 : dols) == NULL) {
950 if (!(dentptr->attr & ATTR_DIR))
955 ret = get_contents (mydata, dentptr, buffer, maxsize);
956 FAT_DPRINT ("Size: %d, got: %ld\n", FAT2CPU32 (dentptr->size), ret);
963 file_fat_detectfs(void)
971 printf("No current device\n");
974 #if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
975 (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_MMC)
976 printf("Interface: ");
977 switch(cur_dev->if_type) {
978 case IF_TYPE_IDE : printf("IDE"); break;
979 case IF_TYPE_SCSI : printf("SCSI"); break;
980 case IF_TYPE_ATAPI : printf("ATAPI"); break;
981 case IF_TYPE_USB : printf("USB"); break;
982 case IF_TYPE_DOC : printf("DOC"); break;
983 case IF_TYPE_MMC : printf("MMC"); break;
984 default : printf("Unknown");
986 printf("\n Device %d: ",cur_dev->dev);
989 if(read_bootsectandvi(&bs, &volinfo, &fatsize)) {
990 printf("\nNo valid FAT fs found\n");
993 memcpy (vol_label, volinfo.volume_label, 11);
994 vol_label[11] = '\0';
995 volinfo.fs_type[5]='\0';
996 printf("Partition %d: Filesystem: %s \"%s\"\n",cur_part,volinfo.fs_type,vol_label);
1002 file_fat_ls(const char *dir)
1004 return do_fat_read(dir, NULL, 0, LS_YES);
1009 file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
1011 printf("reading %s\n",filename);
1012 return do_fat_read(filename, buffer, maxsize, LS_NO);
1015 #endif /* #if (CONFIG_COMMANDS & CFG_CMD_FAT) */