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>
35 * Convert a string to lowercase.
37 static void downcase (char *str)
39 while (*str != '\0') {
45 static block_dev_desc_t *cur_dev = NULL;
47 static unsigned long part_offset = 0;
49 static int cur_part = 1;
51 #define DOS_PART_TBL_OFFSET 0x1be
52 #define DOS_PART_MAGIC_OFFSET 0x1fe
53 #define DOS_FS_TYPE_OFFSET 0x36
54 #define DOS_FS32_TYPE_OFFSET 0x52
56 static int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr)
61 startblock += part_offset;
63 if (cur_dev->block_read) {
64 return cur_dev->block_read(cur_dev->dev, startblock, getsize,
65 (unsigned long *) bufptr);
70 int fat_register_device (block_dev_desc_t * dev_desc, int part_no)
72 unsigned char buffer[SECTOR_SIZE];
74 disk_partition_t info;
76 if (!dev_desc->block_read)
80 /* check if we have a MBR (on floppies we have only a PBR) */
81 if (dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *)buffer) != 1) {
82 printf("** Can't read from device %d **\n",
86 if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
87 buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
88 /* no signature found */
91 #if (defined(CONFIG_CMD_IDE) || \
92 defined(CONFIG_CMD_MG_DISK) || \
93 defined(CONFIG_CMD_SATA) || \
94 defined(CONFIG_CMD_SCSI) || \
95 defined(CONFIG_CMD_USB) || \
96 defined(CONFIG_MMC) || \
97 defined(CONFIG_SYSTEMACE) )
98 /* First we assume there is a MBR */
99 if (!get_partition_info(dev_desc, part_no, &info)) {
100 part_offset = info.start;
102 } else if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3) == 0) ||
103 (strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET], "FAT32", 5) == 0)) {
104 /* ok, we assume we are on a PBR only */
108 printf("** Partition %d not valid on device %d **\n",
109 part_no, dev_desc->dev);
114 if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3) == 0) ||
115 (strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET], "FAT32", 5) == 0)) {
116 /* ok, we assume we are on a PBR only */
119 info.start = part_offset;
121 /* FIXME we need to determine the start block of the
122 * partition where the DOS FS resides. This can be done
123 * by using the get_partition_info routine. For this
124 * purpose the libpart must be included.
134 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
135 * Return index into string if found, -1 otherwise.
137 static int dirdelim (char *str)
141 while (*str != '\0') {
142 if (ISDIRDELIM(*str))
150 * Extract zero terminated short name from a directory entry.
152 static void get_name (dir_entry *dirent, char *s_name)
156 memcpy(s_name, dirent->name, 8);
159 while (*ptr && *ptr != ' ')
161 if (dirent->ext[0] && dirent->ext[0] != ' ') {
164 memcpy(ptr, dirent->ext, 3);
166 while (*ptr && *ptr != ' ')
170 if (*s_name == DELETED_FLAG)
172 else if (*s_name == aRING)
173 *s_name = DELETED_FLAG;
178 * Get the entry at index 'entry' in a FAT (12/16/32) table.
179 * On failure 0x00 is returned.
181 static __u32 get_fatent (fsdata *mydata, __u32 entry)
188 switch (mydata->fatsize) {
190 bufnum = entry / FAT32BUFSIZE;
191 offset = entry - bufnum * FAT32BUFSIZE;
194 bufnum = entry / FAT16BUFSIZE;
195 offset = entry - bufnum * FAT16BUFSIZE;
198 bufnum = entry / FAT12BUFSIZE;
199 offset = entry - bufnum * FAT12BUFSIZE;
203 /* Unsupported FAT size */
207 debug("FAT%d: entry: 0x%04x = %d, offset: 0x%04x = %d\n",
208 mydata->fatsize, entry, entry, offset, offset);
210 /* Read a new block of FAT entries into the cache. */
211 if (bufnum != mydata->fatbufnum) {
212 int getsize = FATBUFSIZE / FS_BLOCK_SIZE;
213 __u8 *bufptr = mydata->fatbuf;
214 __u32 fatlength = mydata->fatlength;
215 __u32 startblock = bufnum * FATBUFBLOCKS;
217 fatlength *= SECTOR_SIZE; /* We want it in bytes now */
218 startblock += mydata->fat_sect; /* Offset from start of disk */
220 if (getsize > fatlength)
222 if (disk_read(startblock, getsize, bufptr) < 0) {
223 debug("Error reading FAT blocks\n");
226 mydata->fatbufnum = bufnum;
229 /* Get the actual entry from the table */
230 switch (mydata->fatsize) {
232 ret = FAT2CPU32(((__u32 *) mydata->fatbuf)[offset]);
235 ret = FAT2CPU16(((__u16 *) mydata->fatbuf)[offset]);
238 off16 = (offset * 3) / 4;
240 switch (offset & 0x3) {
242 ret = FAT2CPU16(((__u16 *) mydata->fatbuf)[off16]);
246 val1 = FAT2CPU16(((__u16 *)mydata->fatbuf)[off16]);
248 val2 = FAT2CPU16(((__u16 *)mydata->fatbuf)[off16 + 1]);
250 ret = (val2 << 4) | (val1 >> 12);
253 val1 = FAT2CPU16(((__u16 *)mydata->fatbuf)[off16]);
255 val2 = FAT2CPU16(((__u16 *)mydata->fatbuf)[off16 + 1]);
257 ret = (val2 << 8) | (val1 >> 8);
260 ret = FAT2CPU16(((__u16 *)mydata->fatbuf)[off16]);
261 ret = (ret & 0xfff0) >> 4;
268 debug("FAT%d: ret: %08x, offset: %04x\n",
269 mydata->fatsize, ret, offset);
275 * Read at most 'size' bytes from the specified cluster into 'buffer'.
276 * Return 0 on success, -1 otherwise.
279 get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer,
286 startsect = mydata->data_begin +
287 clustnum * mydata->clust_size;
289 startsect = mydata->rootdir_sect;
292 debug("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
294 if (disk_read(startsect, size / FS_BLOCK_SIZE, buffer) < 0) {
295 debug("Error reading data\n");
298 if (size % FS_BLOCK_SIZE) {
299 __u8 tmpbuf[FS_BLOCK_SIZE];
301 idx = size / FS_BLOCK_SIZE;
302 if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
303 debug("Error reading data\n");
306 buffer += idx * FS_BLOCK_SIZE;
308 memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
316 * Read at most 'maxsize' bytes from the file associated with 'dentptr'
318 * Return the number of bytes read or -1 on fatal errors.
321 get_contents (fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
322 unsigned long maxsize)
324 unsigned long filesize = FAT2CPU32(dentptr->size), gotsize = 0;
325 unsigned int bytesperclust = mydata->clust_size * SECTOR_SIZE;
326 __u32 curclust = START(dentptr);
327 __u32 endclust, newclust;
328 unsigned long actsize;
330 debug("Filesize: %ld bytes\n", filesize);
332 if (maxsize > 0 && filesize > maxsize)
335 debug("%ld bytes\n", filesize);
337 actsize = bytesperclust;
341 /* search for consecutive clusters */
342 while (actsize < filesize) {
343 newclust = get_fatent(mydata, endclust);
344 if ((newclust - 1) != endclust)
346 if (CHECK_CLUST(newclust, mydata->fatsize)) {
347 debug("curclust: 0x%x\n", newclust);
348 debug("Invalid FAT entry\n");
352 actsize += bytesperclust;
355 /* actsize >= file size */
356 actsize -= bytesperclust;
358 /* get remaining clusters */
359 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
360 printf("Error reading cluster\n");
364 /* get remaining bytes */
365 gotsize += (int)actsize;
369 if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
370 printf("Error reading cluster\n");
376 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
377 printf("Error reading cluster\n");
380 gotsize += (int)actsize;
384 curclust = get_fatent(mydata, endclust);
385 if (CHECK_CLUST(curclust, mydata->fatsize)) {
386 debug("curclust: 0x%x\n", curclust);
387 printf("Invalid FAT entry\n");
390 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.
401 static int 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)
411 for (j = 0; j <= 10; j += 2) {
412 l_name[*idx] = slotptr->name5_10[j];
413 if (l_name[*idx] == 0x00)
417 for (j = 0; j <= 2; j += 2) {
418 l_name[*idx] = slotptr->name11_12[j];
419 if (l_name[*idx] == 0x00)
428 * Extract the full long filename starting at 'retdent' (which is really
429 * a slot) into 'l_name'. If successful also copy the real directory entry
431 * Return 0 on success, -1 otherwise.
433 __attribute__ ((__aligned__ (__alignof__ (dir_entry))))
434 __u8 get_vfatname_block[MAX_CLUSTSIZE];
437 get_vfatname (fsdata *mydata, int curclust, __u8 *cluster,
438 dir_entry *retdent, char *l_name)
441 dir_slot *slotptr = (dir_slot *)retdent;
442 __u8 *nextclust = cluster + mydata->clust_size * SECTOR_SIZE;
443 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
446 while ((__u8 *)slotptr < nextclust) {
449 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
455 if ((__u8 *)slotptr >= nextclust) {
459 curclust = get_fatent(mydata, curclust);
460 if (CHECK_CLUST(curclust, mydata->fatsize)) {
461 debug("curclust: 0x%x\n", curclust);
462 printf("Invalid FAT entry\n");
466 if (get_cluster(mydata, curclust, get_vfatname_block,
467 mydata->clust_size * SECTOR_SIZE) != 0) {
468 debug("Error: reading directory block\n");
472 slotptr2 = (dir_slot *)get_vfatname_block;
473 while (slotptr2->id > 0x01)
476 /* Save the real directory entry */
477 realdent = (dir_entry *)slotptr2 + 1;
478 while ((__u8 *)slotptr2 >= get_vfatname_block) {
479 slot2str(slotptr2, l_name, &idx);
483 /* Save the real directory entry */
484 realdent = (dir_entry *)slotptr;
489 if (slot2str(slotptr, l_name, &idx))
491 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
494 if (*l_name == DELETED_FLAG)
496 else if (*l_name == aRING)
497 *l_name = DELETED_FLAG;
500 /* Return the real directory entry */
501 memcpy(retdent, realdent, sizeof(dir_entry));
506 /* Calculate short name checksum */
507 static __u8 mkcksum (const char *str)
513 for (i = 0; i < 11; i++) {
514 ret = (((ret & 1) << 7) | ((ret & 0xfe) >> 1)) + str[i];
519 #endif /* CONFIG_SUPPORT_VFAT */
522 * Get the directory entry associated with 'filename' from the directory
523 * starting at 'startsect'
525 __attribute__ ((__aligned__ (__alignof__ (dir_entry))))
526 __u8 get_dentfromdir_block[MAX_CLUSTSIZE];
528 static dir_entry *get_dentfromdir (fsdata *mydata, int startsect,
529 char *filename, dir_entry *retdent,
532 __u16 prevcksum = 0xffff;
533 __u32 curclust = START(retdent);
534 int files = 0, dirs = 0;
536 debug("get_dentfromdir: %s\n", filename);
543 if (get_cluster(mydata, curclust, get_dentfromdir_block,
544 mydata->clust_size * SECTOR_SIZE) != 0) {
545 debug("Error: reading directory block\n");
549 dentptr = (dir_entry *)get_dentfromdir_block;
551 for (i = 0; i < DIRENTSPERCLUST; i++) {
552 char s_name[14], l_name[256];
555 if (dentptr->name[0] == DELETED_FLAG) {
559 if ((dentptr->attr & ATTR_VOLUME)) {
560 #ifdef CONFIG_SUPPORT_VFAT
561 if ((dentptr->attr & ATTR_VFAT) &&
562 (dentptr-> name[0] & LAST_LONG_ENTRY_MASK)) {
563 prevcksum = ((dir_slot *)dentptr)->alias_checksum;
564 get_vfatname(mydata, curclust,
565 get_dentfromdir_block,
572 isdir = (dentptr->attr & ATTR_DIR);
580 if (l_name[0] != 0) {
587 printf(" %8ld %s%c\n",
588 (long)FAT2CPU32(dentptr->size),
600 debug("vfatname: |%s|\n", l_name);
604 /* Volume label or VFAT entry */
609 if (dentptr->name[0] == 0) {
611 printf("\n%d file(s), %d dir(s)\n\n",
614 debug("Dentname == NULL - %d\n", i);
617 #ifdef CONFIG_SUPPORT_VFAT
618 if (dols && mkcksum(dentptr->name) == prevcksum) {
623 get_name(dentptr, s_name);
625 int isdir = (dentptr->attr & ATTR_DIR);
635 if (s_name[0] != 0) {
643 printf(" %8ld %s%c\n",
644 (long)FAT2CPU32(dentptr->size),
656 if (strcmp(filename, s_name)
657 && strcmp(filename, l_name)) {
658 debug("Mismatch: |%s|%s|\n", s_name, l_name);
663 memcpy(retdent, dentptr, sizeof(dir_entry));
665 debug("DentName: %s", s_name);
666 debug(", start: 0x%x", START(dentptr));
667 debug(", size: 0x%x %s\n",
668 FAT2CPU32(dentptr->size),
669 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
674 curclust = get_fatent(mydata, curclust);
675 if (CHECK_CLUST(curclust, mydata->fatsize)) {
676 debug("curclust: 0x%x\n", curclust);
677 printf("Invalid FAT entry\n");
686 * Read boot sector and volume info from a FAT filesystem
689 read_bootsectandvi (boot_sector *bs, volume_info *volinfo, int *fatsize)
691 __u8 block[FS_BLOCK_SIZE];
693 volume_info *vistart;
695 if (disk_read (0, 1, block) < 0) {
696 debug("Error: reading block\n");
700 memcpy(bs, block, sizeof(boot_sector));
701 bs->reserved = FAT2CPU16(bs->reserved);
702 bs->fat_length = FAT2CPU16(bs->fat_length);
703 bs->secs_track = FAT2CPU16(bs->secs_track);
704 bs->heads = FAT2CPU16(bs->heads);
705 bs->total_sect = FAT2CPU32(bs->total_sect);
708 if (bs->fat_length == 0) {
710 bs->fat32_length = FAT2CPU32(bs->fat32_length);
711 bs->flags = FAT2CPU16(bs->flags);
712 bs->root_cluster = FAT2CPU32(bs->root_cluster);
713 bs->info_sector = FAT2CPU16(bs->info_sector);
714 bs->backup_boot = FAT2CPU16(bs->backup_boot);
715 vistart = (volume_info *)(block + sizeof(boot_sector));
718 vistart = (volume_info *)&(bs->fat32_length);
721 memcpy(volinfo, vistart, sizeof(volume_info));
723 if (*fatsize == 32) {
724 if (strncmp(FAT32_SIGN, vistart->fs_type, SIGNLEN) == 0)
727 if (strncmp(FAT12_SIGN, vistart->fs_type, SIGNLEN) == 0) {
731 if (strncmp(FAT16_SIGN, vistart->fs_type, SIGNLEN) == 0) {
737 debug("Error: broken fs_type sign\n");
741 __attribute__ ((__aligned__ (__alignof__ (dir_entry))))
742 __u8 do_fat_read_block[MAX_CLUSTSIZE];
745 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
748 char fnamecopy[2048];
752 fsdata *mydata = &datablock;
754 __u16 prevcksum = 0xffff;
758 int files = 0, dirs = 0;
764 if (read_bootsectandvi(&bs, &volinfo, &mydata->fatsize)) {
765 debug("Error: reading boot sector\n");
769 root_cluster = bs.root_cluster;
771 if (mydata->fatsize == 32)
772 mydata->fatlength = bs.fat32_length;
774 mydata->fatlength = bs.fat_length;
776 mydata->fat_sect = bs.reserved;
778 cursect = mydata->rootdir_sect
779 = mydata->fat_sect + mydata->fatlength * bs.fats;
781 mydata->clust_size = bs.cluster_size;
783 if (mydata->fatsize == 32) {
784 mydata->data_begin = mydata->rootdir_sect -
785 (mydata->clust_size * 2);
789 rootdir_size = ((bs.dir_entries[1] * (int)256 +
793 mydata->data_begin = mydata->rootdir_sect +
795 (mydata->clust_size * 2);
798 mydata->fatbufnum = -1;
800 #ifdef CONFIG_SUPPORT_VFAT
801 debug("VFAT Support enabled\n");
803 debug("FAT%d, fat_sect: %d, fatlength: %d\n",
804 mydata->fatsize, mydata->fat_sect, mydata->fatlength);
805 debug("Rootdir begins at cluster: %d, sector: %d, offset: %x\n"
806 "Data begins at: %d\n",
808 mydata->rootdir_sect,
809 mydata->rootdir_sect * SECTOR_SIZE, mydata->data_begin);
810 debug("Cluster size: %d\n", mydata->clust_size);
812 /* "cwd" is always the root... */
813 while (ISDIRDELIM(*filename))
816 /* Make a copy of the filename and convert it to lowercase */
817 strcpy(fnamecopy, filename);
820 if (*fnamecopy == '\0') {
825 } else if ((idx = dirdelim(fnamecopy)) >= 0) {
827 fnamecopy[idx] = '\0';
828 subname = fnamecopy + idx + 1;
830 /* Handle multiple delimiters */
831 while (ISDIRDELIM(*subname))
841 debug("FAT read sect=%d, clust_size=%d, DIRENTSPERBLOCK=%d\n",
842 cursect, mydata->clust_size, DIRENTSPERBLOCK);
844 if (disk_read(cursect, mydata->clust_size, do_fat_read_block) < 0) {
845 debug("Error: reading rootdir block\n");
849 dentptr = (dir_entry *) do_fat_read_block;
851 for (i = 0; i < DIRENTSPERBLOCK; i++) {
852 char s_name[14], l_name[256];
855 if ((dentptr->attr & ATTR_VOLUME)) {
856 #ifdef CONFIG_SUPPORT_VFAT
857 if ((dentptr->attr & ATTR_VFAT) &&
858 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
860 ((dir_slot *)dentptr)->alias_checksum;
862 get_vfatname(mydata, 0,
866 if (dols == LS_ROOT) {
870 (dentptr->attr & ATTR_DIR);
878 if (l_name[0] != 0) {
885 printf(" %8ld %s%c\n",
886 (long)FAT2CPU32(dentptr->size),
898 debug("Rootvfatname: |%s|\n",
903 /* Volume label or VFAT entry */
907 } else if (dentptr->name[0] == 0) {
908 debug("RootDentname == NULL - %d\n", i);
909 if (dols == LS_ROOT) {
910 printf("\n%d file(s), %d dir(s)\n\n",
916 #ifdef CONFIG_SUPPORT_VFAT
917 else if (dols == LS_ROOT &&
918 mkcksum(dentptr->name) == prevcksum) {
923 get_name(dentptr, s_name);
925 if (dols == LS_ROOT) {
926 int isdir = (dentptr->attr & ATTR_DIR);
932 if (s_name[0] != 0) {
938 if (s_name[0] != 0) {
945 printf(" %8ld %s%c\n",
946 (long)FAT2CPU32(dentptr->size),
957 if (strcmp(fnamecopy, s_name)
958 && strcmp(fnamecopy, l_name)) {
959 debug("RootMismatch: |%s|%s|\n", s_name,
965 if (isdir && !(dentptr->attr & ATTR_DIR))
968 debug("RootName: %s", s_name);
969 debug(", start: 0x%x", START(dentptr));
970 debug(", size: 0x%x %s\n",
971 FAT2CPU32(dentptr->size),
972 isdir ? "(DIR)" : "");
974 goto rootdir_done; /* We got a match */
976 debug("END LOOP: j=%d clust_size=%d\n", j,
980 * On FAT32 we must fetch the FAT entries for the next
981 * root directory clusters when a cluster has been
982 * completely processed.
984 if ((mydata->fatsize == 32) && (++j == mydata->clust_size)) {
988 nxt_clust = get_fatent(mydata, root_cluster);
990 nxtsect = mydata->data_begin +
991 (nxt_clust * mydata->clust_size);
993 debug("END LOOP: sect=%d, root_clust=%d, "
994 "n_sect=%d, n_clust=%d\n",
995 cursect, root_cluster,
998 root_cluster = nxt_clust;
1011 int startsect = mydata->data_begin
1012 + START(dentptr) * mydata->clust_size;
1014 char *nextname = NULL;
1019 idx = dirdelim(subname);
1022 subname[idx] = '\0';
1023 nextname = subname + idx + 1;
1024 /* Handle multiple delimiters */
1025 while (ISDIRDELIM(*nextname))
1027 if (dols && *nextname == '\0')
1030 if (dols && firsttime) {
1037 if (get_dentfromdir(mydata, startsect, subname, dentptr,
1038 isdir ? 0 : dols) == NULL) {
1045 if (!(dentptr->attr & ATTR_DIR))
1051 ret = get_contents(mydata, dentptr, buffer, maxsize);
1052 debug("Size: %d, got: %ld\n", FAT2CPU32(dentptr->size), ret);
1057 int file_fat_detectfs (void)
1060 volume_info volinfo;
1064 if (cur_dev == NULL) {
1065 printf("No current device\n");
1069 #if defined(CONFIG_CMD_IDE) || \
1070 defined(CONFIG_CMD_MG_DISK) || \
1071 defined(CONFIG_CMD_SATA) || \
1072 defined(CONFIG_CMD_SCSI) || \
1073 defined(CONFIG_CMD_USB) || \
1075 printf("Interface: ");
1076 switch (cur_dev->if_type) {
1102 printf("\n Device %d: ", cur_dev->dev);
1106 if (read_bootsectandvi(&bs, &volinfo, &fatsize)) {
1107 printf("\nNo valid FAT fs found\n");
1111 memcpy(vol_label, volinfo.volume_label, 11);
1112 vol_label[11] = '\0';
1113 volinfo.fs_type[5] = '\0';
1115 printf("Partition %d: Filesystem: %s \"%s\"\n", cur_part,
1116 volinfo.fs_type, vol_label);
1121 int file_fat_ls (const char *dir)
1123 return do_fat_read(dir, NULL, 0, LS_YES);
1126 long file_fat_read (const char *filename, void *buffer, unsigned long maxsize)
1128 printf("reading %s\n", filename);
1129 return do_fat_read(filename, buffer, maxsize, LS_NO);