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.
40 while (*str != '\0') {
46 static block_dev_desc_t *cur_dev = NULL;
47 static unsigned long part_offset = 0;
48 static int cur_part = 1;
50 #define DOS_PART_TBL_OFFSET 0x1be
51 #define DOS_PART_MAGIC_OFFSET 0x1fe
52 #define DOS_FS_TYPE_OFFSET 0x36
54 int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr)
56 startblock += part_offset;
59 if (cur_dev->block_read) {
60 return cur_dev->block_read (cur_dev->dev
61 , startblock, getsize, (unsigned long *)bufptr);
68 fat_register_device(block_dev_desc_t *dev_desc, int part_no)
70 unsigned char buffer[SECTOR_SIZE];
71 disk_partition_t info;
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 (defined(CONFIG_CMD_IDE) || \
87 defined(CONFIG_CMD_MG_DISK) || \
88 defined(CONFIG_CMD_SATA) || \
89 defined(CONFIG_CMD_SCSI) || \
90 defined(CONFIG_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",
103 part_no, dev_desc->dev);
108 if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
109 /* ok, we assume we are on a PBR only */
112 info.start = part_offset;
114 /* FIXME we need to determine the start block of the
115 * partition where the DOS FS resides. This can be done
116 * by using the get_partition_info routine. For this
117 * purpose the libpart must be included.
128 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
129 * Return index into string if found, -1 otherwise.
136 while (*str != '\0') {
137 if (ISDIRDELIM(*str)) return str - start;
144 * Extract zero terminated short name from a directory entry.
146 static void get_name (dir_entry *dirent, char *s_name)
150 memcpy (s_name, dirent->name, 8);
153 while (*ptr && *ptr != ' ')
155 if (dirent->ext[0] && dirent->ext[0] != ' ') {
158 memcpy (ptr, dirent->ext, 3);
160 while (*ptr && *ptr != ' ')
164 if (*s_name == DELETED_FLAG)
166 else if (*s_name == aRING)
167 *s_name = DELETED_FLAG;
172 * Get the entry at index 'entry' in a FAT (12/16/32) table.
173 * On failure 0x00 is returned.
176 get_fatent(fsdata *mydata, __u32 entry)
182 switch (mydata->fatsize) {
184 bufnum = entry / FAT32BUFSIZE;
185 offset = entry - bufnum * FAT32BUFSIZE;
188 bufnum = entry / FAT16BUFSIZE;
189 offset = entry - bufnum * FAT16BUFSIZE;
192 bufnum = entry / FAT12BUFSIZE;
193 offset = entry - bufnum * FAT12BUFSIZE;
197 /* Unsupported FAT size */
201 /* Read a new block of FAT entries into the cache. */
202 if (bufnum != mydata->fatbufnum) {
203 int getsize = FATBUFSIZE/FS_BLOCK_SIZE;
204 __u8 *bufptr = mydata->fatbuf;
205 __u32 fatlength = mydata->fatlength;
206 __u32 startblock = bufnum * FATBUFBLOCKS;
208 fatlength *= SECTOR_SIZE; /* We want it in bytes now */
209 startblock += mydata->fat_sect; /* Offset from start of disk */
211 if (getsize > fatlength) getsize = fatlength;
212 if (disk_read(startblock, getsize, bufptr) < 0) {
213 FAT_DPRINT("Error reading FAT blocks\n");
216 mydata->fatbufnum = bufnum;
219 /* Get the actual entry from the table */
220 switch (mydata->fatsize) {
222 ret = FAT2CPU32(((__u32*)mydata->fatbuf)[offset]);
225 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[offset]);
228 __u32 off16 = (offset*3)/4;
231 switch (offset & 0x3) {
233 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
237 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
239 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
241 ret = (val2 << 4) | (val1 >> 12);
244 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
246 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
248 ret = (val2 << 8) | (val1 >> 8);
251 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);;
252 ret = (ret & 0xfff0) >> 4;
260 FAT_DPRINT("ret: %d, offset: %d\n", ret, offset);
267 * Read at most 'size' bytes from the specified cluster into 'buffer'.
268 * Return 0 on success, -1 otherwise.
271 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
277 startsect = mydata->data_begin + clustnum*mydata->clust_size;
279 startsect = mydata->rootdir_sect;
282 FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
283 if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
284 FAT_DPRINT("Error reading data\n");
287 if(size % FS_BLOCK_SIZE) {
288 __u8 tmpbuf[FS_BLOCK_SIZE];
289 idx= size/FS_BLOCK_SIZE;
290 if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
291 FAT_DPRINT("Error reading data\n");
294 buffer += idx*FS_BLOCK_SIZE;
296 memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
305 * Read at most 'maxsize' bytes from the file associated with 'dentptr'
307 * Return the number of bytes read or -1 on fatal errors.
310 get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
311 unsigned long maxsize)
313 unsigned long filesize = FAT2CPU32(dentptr->size), gotsize = 0;
314 unsigned int bytesperclust = mydata->clust_size * SECTOR_SIZE;
315 __u32 curclust = START(dentptr);
316 __u32 endclust, newclust;
317 unsigned long actsize;
319 FAT_DPRINT("Filesize: %ld bytes\n", filesize);
321 if (maxsize > 0 && filesize > maxsize) filesize = maxsize;
323 FAT_DPRINT("Reading: %ld bytes\n", filesize);
325 actsize=bytesperclust;
328 /* search for consecutive clusters */
329 while(actsize < filesize) {
330 newclust = get_fatent(mydata, endclust);
331 if((newclust -1)!=endclust)
333 if (CHECK_CLUST(newclust, mydata->fatsize)) {
334 FAT_DPRINT("curclust: 0x%x\n", newclust);
335 FAT_DPRINT("Invalid FAT entry\n");
339 actsize+= bytesperclust;
341 /* actsize >= file size */
342 actsize -= bytesperclust;
343 /* get remaining clusters */
344 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
345 FAT_ERROR("Error reading cluster\n");
348 /* get remaining bytes */
349 gotsize += (int)actsize;
353 if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
354 FAT_ERROR("Error reading cluster\n");
360 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
361 FAT_ERROR("Error reading cluster\n");
364 gotsize += (int)actsize;
367 curclust = get_fatent(mydata, endclust);
368 if (CHECK_CLUST(curclust, mydata->fatsize)) {
369 FAT_DPRINT("curclust: 0x%x\n", curclust);
370 FAT_ERROR("Invalid FAT entry\n");
373 actsize=bytesperclust;
379 #ifdef CONFIG_SUPPORT_VFAT
381 * Extract the file name information from 'slotptr' into 'l_name',
382 * starting at l_name[*idx].
383 * Return 1 if terminator (zero byte) is found, 0 otherwise.
386 slot2str(dir_slot *slotptr, char *l_name, int *idx)
390 for (j = 0; j <= 8; j += 2) {
391 l_name[*idx] = slotptr->name0_4[j];
392 if (l_name[*idx] == 0x00) return 1;
395 for (j = 0; j <= 10; j += 2) {
396 l_name[*idx] = slotptr->name5_10[j];
397 if (l_name[*idx] == 0x00) return 1;
400 for (j = 0; j <= 2; j += 2) {
401 l_name[*idx] = slotptr->name11_12[j];
402 if (l_name[*idx] == 0x00) return 1;
411 * Extract the full long filename starting at 'retdent' (which is really
412 * a slot) into 'l_name'. If successful also copy the real directory entry
414 * Return 0 on success, -1 otherwise.
416 __attribute__ ((__aligned__(__alignof__(dir_entry))))
417 __u8 get_vfatname_block[MAX_CLUSTSIZE];
419 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
420 dir_entry *retdent, char *l_name)
423 dir_slot *slotptr = (dir_slot*) retdent;
424 __u8 *nextclust = cluster + mydata->clust_size * SECTOR_SIZE;
425 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
428 while ((__u8*)slotptr < nextclust) {
429 if (counter == 0) break;
430 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
436 if ((__u8*)slotptr >= nextclust) {
440 curclust = get_fatent(mydata, curclust);
441 if (CHECK_CLUST(curclust, mydata->fatsize)) {
442 FAT_DPRINT("curclust: 0x%x\n", curclust);
443 FAT_ERROR("Invalid FAT entry\n");
446 if (get_cluster(mydata, curclust, get_vfatname_block,
447 mydata->clust_size * SECTOR_SIZE) != 0) {
448 FAT_DPRINT("Error: reading directory block\n");
451 slotptr2 = (dir_slot*) get_vfatname_block;
452 while (slotptr2->id > 0x01) {
455 /* Save the real directory entry */
456 realdent = (dir_entry*)slotptr2 + 1;
457 while ((__u8*)slotptr2 >= get_vfatname_block) {
458 slot2str(slotptr2, l_name, &idx);
462 /* Save the real directory entry */
463 realdent = (dir_entry*)slotptr;
468 if (slot2str(slotptr, l_name, &idx)) break;
469 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
472 if (*l_name == DELETED_FLAG) *l_name = '\0';
473 else if (*l_name == aRING) *l_name = DELETED_FLAG;
476 /* Return the real directory entry */
477 memcpy(retdent, realdent, sizeof(dir_entry));
483 /* Calculate short name checksum */
485 mkcksum(const char *str)
490 for (i = 0; i < 11; i++) {
491 ret = (((ret&1)<<7)|((ret&0xfe)>>1)) + str[i];
500 * Get the directory entry associated with 'filename' from the directory
501 * starting at 'startsect'
503 __attribute__ ((__aligned__(__alignof__(dir_entry))))
504 __u8 get_dentfromdir_block[MAX_CLUSTSIZE];
505 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
506 char *filename, dir_entry * retdent,
509 __u16 prevcksum = 0xffff;
510 __u32 curclust = START (retdent);
511 int files = 0, dirs = 0;
513 FAT_DPRINT ("get_dentfromdir: %s\n", filename);
518 if (get_cluster (mydata, curclust, get_dentfromdir_block,
519 mydata->clust_size * SECTOR_SIZE) != 0) {
520 FAT_DPRINT ("Error: reading directory block\n");
523 dentptr = (dir_entry *) get_dentfromdir_block;
524 for (i = 0; i < DIRENTSPERCLUST; i++) {
525 char s_name[14], l_name[256];
528 if (dentptr->name[0] == DELETED_FLAG) {
532 if ((dentptr->attr & ATTR_VOLUME)) {
533 #ifdef CONFIG_SUPPORT_VFAT
534 if ((dentptr->attr & ATTR_VFAT) &&
535 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
536 prevcksum = ((dir_slot *) dentptr)
538 get_vfatname (mydata, curclust, get_dentfromdir_block,
541 int isdir = (dentptr->attr & ATTR_DIR);
551 if (l_name[0] != 0) {
558 printf (" %8ld %s%c\n",
559 (long) FAT2CPU32 (dentptr->size),
562 printf (" %s%c\n", l_name, dirc);
568 FAT_DPRINT ("vfatname: |%s|\n", l_name);
572 /* Volume label or VFAT entry */
577 if (dentptr->name[0] == 0) {
579 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
581 FAT_DPRINT ("Dentname == NULL - %d\n", i);
584 #ifdef CONFIG_SUPPORT_VFAT
585 if (dols && mkcksum (dentptr->name) == prevcksum) {
590 get_name (dentptr, s_name);
592 int isdir = (dentptr->attr & ATTR_DIR);
602 if (s_name[0] != 0) {
609 printf (" %8ld %s%c\n",
610 (long) FAT2CPU32 (dentptr->size), s_name,
613 printf (" %s%c\n", s_name, dirc);
619 if (strcmp (filename, s_name) && strcmp (filename, l_name)) {
620 FAT_DPRINT ("Mismatch: |%s|%s|\n", s_name, l_name);
624 memcpy (retdent, dentptr, sizeof (dir_entry));
626 FAT_DPRINT ("DentName: %s", s_name);
627 FAT_DPRINT (", start: 0x%x", START (dentptr));
628 FAT_DPRINT (", size: 0x%x %s\n",
629 FAT2CPU32 (dentptr->size),
630 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
634 curclust = get_fatent (mydata, curclust);
635 if (CHECK_CLUST(curclust, mydata->fatsize)) {
636 FAT_DPRINT ("curclust: 0x%x\n", curclust);
637 FAT_ERROR ("Invalid FAT entry\n");
647 * Read boot sector and volume info from a FAT filesystem
650 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
652 __u8 block[FS_BLOCK_SIZE];
653 volume_info *vistart;
655 if (disk_read(0, 1, block) < 0) {
656 FAT_DPRINT("Error: reading block\n");
660 memcpy(bs, block, sizeof(boot_sector));
661 bs->reserved = FAT2CPU16(bs->reserved);
662 bs->fat_length = FAT2CPU16(bs->fat_length);
663 bs->secs_track = FAT2CPU16(bs->secs_track);
664 bs->heads = FAT2CPU16(bs->heads);
666 bs->hidden = FAT2CPU32(bs->hidden);
668 bs->total_sect = FAT2CPU32(bs->total_sect);
671 if (bs->fat_length == 0) {
673 bs->fat32_length = FAT2CPU32(bs->fat32_length);
674 bs->flags = FAT2CPU16(bs->flags);
675 bs->root_cluster = FAT2CPU32(bs->root_cluster);
676 bs->info_sector = FAT2CPU16(bs->info_sector);
677 bs->backup_boot = FAT2CPU16(bs->backup_boot);
678 vistart = (volume_info*) (block + sizeof(boot_sector));
681 vistart = (volume_info*) &(bs->fat32_length);
684 memcpy(volinfo, vistart, sizeof(volume_info));
686 if (*fatsize == 32) {
687 if (strncmp(FAT32_SIGN, vistart->fs_type, SIGNLEN) == 0) {
691 if (strncmp(FAT12_SIGN, vistart->fs_type, SIGNLEN) == 0) {
695 if (strncmp(FAT16_SIGN, vistart->fs_type, SIGNLEN) == 0) {
701 FAT_DPRINT("Error: broken fs_type sign\n");
705 __attribute__ ((__aligned__(__alignof__(dir_entry))))
706 __u8 do_fat_read_block[MAX_CLUSTSIZE];
708 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
711 #if CONFIG_NIOS /* NIOS CPU cannot access big automatic arrays */
714 char fnamecopy[2048];
718 fsdata *mydata = &datablock;
720 __u16 prevcksum = 0xffff;
722 int rootdir_size, cursect;
724 int files = 0, dirs = 0;
728 if (read_bootsectandvi (&bs, &volinfo, &mydata->fatsize)) {
729 FAT_DPRINT ("Error: reading boot sector\n");
732 if (mydata->fatsize == 32) {
733 mydata->fatlength = bs.fat32_length;
735 mydata->fatlength = bs.fat_length;
737 mydata->fat_sect = bs.reserved;
738 cursect = mydata->rootdir_sect
739 = mydata->fat_sect + mydata->fatlength * bs.fats;
740 mydata->clust_size = bs.cluster_size;
741 if (mydata->fatsize == 32) {
742 rootdir_size = mydata->clust_size;
743 mydata->data_begin = mydata->rootdir_sect /* + rootdir_size */
744 - (mydata->clust_size * 2);
746 rootdir_size = ((bs.dir_entries[1] * (int) 256 + bs.dir_entries[0])
747 * sizeof (dir_entry)) / SECTOR_SIZE;
748 mydata->data_begin = mydata->rootdir_sect + rootdir_size
749 - (mydata->clust_size * 2);
751 mydata->fatbufnum = -1;
753 FAT_DPRINT ("FAT%d, fatlength: %d\n", mydata->fatsize,
755 FAT_DPRINT ("Rootdir begins at sector: %d, offset: %x, size: %d\n"
756 "Data begins at: %d\n",
757 mydata->rootdir_sect, mydata->rootdir_sect * SECTOR_SIZE,
758 rootdir_size, mydata->data_begin);
759 FAT_DPRINT ("Cluster size: %d\n", mydata->clust_size);
761 /* "cwd" is always the root... */
762 while (ISDIRDELIM (*filename))
764 /* Make a copy of the filename and convert it to lowercase */
765 strcpy (fnamecopy, filename);
766 downcase (fnamecopy);
767 if (*fnamecopy == '\0') {
771 } else if ((idx = dirdelim (fnamecopy)) >= 0) {
773 fnamecopy[idx] = '\0';
774 subname = fnamecopy + idx + 1;
775 /* Handle multiple delimiters */
776 while (ISDIRDELIM (*subname))
785 if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
786 FAT_DPRINT ("Error: reading rootdir block\n");
789 dentptr = (dir_entry *) do_fat_read_block;
790 for (i = 0; i < DIRENTSPERBLOCK; i++) {
791 char s_name[14], l_name[256];
794 if ((dentptr->attr & ATTR_VOLUME)) {
795 #ifdef CONFIG_SUPPORT_VFAT
796 if ((dentptr->attr & ATTR_VFAT) &&
797 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
798 prevcksum = ((dir_slot *) dentptr)->alias_checksum;
799 get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
800 if (dols == LS_ROOT) {
801 int isdir = (dentptr->attr & ATTR_DIR);
811 if (l_name[0] != 0) {
818 printf (" %8ld %s%c\n",
819 (long) FAT2CPU32 (dentptr->size),
822 printf (" %s%c\n", l_name, dirc);
828 FAT_DPRINT ("Rootvfatname: |%s|\n", l_name);
832 /* Volume label or VFAT entry */
836 } else if (dentptr->name[0] == 0) {
837 FAT_DPRINT ("RootDentname == NULL - %d\n", i);
838 if (dols == LS_ROOT) {
839 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
844 #ifdef CONFIG_SUPPORT_VFAT
845 else if (dols == LS_ROOT
846 && mkcksum (dentptr->name) == prevcksum) {
851 get_name (dentptr, s_name);
852 if (dols == LS_ROOT) {
853 int isdir = (dentptr->attr & ATTR_DIR);
859 if (s_name[0] != 0) {
865 if (s_name[0] != 0) {
872 printf (" %8ld %s%c\n",
873 (long) FAT2CPU32 (dentptr->size), s_name,
876 printf (" %s%c\n", s_name, dirc);
882 if (strcmp (fnamecopy, s_name) && strcmp (fnamecopy, l_name)) {
883 FAT_DPRINT ("RootMismatch: |%s|%s|\n", s_name, l_name);
887 if (isdir && !(dentptr->attr & ATTR_DIR))
890 FAT_DPRINT ("RootName: %s", s_name);
891 FAT_DPRINT (", start: 0x%x", START (dentptr));
892 FAT_DPRINT (", size: 0x%x %s\n",
893 FAT2CPU32 (dentptr->size), isdir ? "(DIR)" : "");
895 goto rootdir_done; /* We got a match */
903 int startsect = mydata->data_begin
904 + START (dentptr) * mydata->clust_size;
906 char *nextname = NULL;
911 idx = dirdelim (subname);
914 nextname = subname + idx + 1;
915 /* Handle multiple delimiters */
916 while (ISDIRDELIM (*nextname))
918 if (dols && *nextname == '\0')
921 if (dols && firsttime) {
928 if (get_dentfromdir (mydata, startsect, subname, dentptr,
929 isdir ? 0 : dols) == NULL) {
936 if (!(dentptr->attr & ATTR_DIR))
941 ret = get_contents (mydata, dentptr, buffer, maxsize);
942 FAT_DPRINT ("Size: %d, got: %ld\n", FAT2CPU32 (dentptr->size), ret);
949 file_fat_detectfs(void)
957 printf("No current device\n");
960 #if defined(CONFIG_CMD_IDE) || \
961 defined(CONFIG_CMD_MG_DISK) || \
962 defined(CONFIG_CMD_SATA) || \
963 defined(CONFIG_CMD_SCSI) || \
964 defined(CONFIG_CMD_USB) || \
966 printf("Interface: ");
967 switch(cur_dev->if_type) {
968 case IF_TYPE_IDE : printf("IDE"); break;
969 case IF_TYPE_SATA : printf("SATA"); break;
970 case IF_TYPE_SCSI : printf("SCSI"); break;
971 case IF_TYPE_ATAPI : printf("ATAPI"); break;
972 case IF_TYPE_USB : printf("USB"); break;
973 case IF_TYPE_DOC : printf("DOC"); break;
974 case IF_TYPE_MMC : printf("MMC"); break;
975 default : printf("Unknown");
977 printf("\n Device %d: ",cur_dev->dev);
980 if(read_bootsectandvi(&bs, &volinfo, &fatsize)) {
981 printf("\nNo valid FAT fs found\n");
984 memcpy (vol_label, volinfo.volume_label, 11);
985 vol_label[11] = '\0';
986 volinfo.fs_type[5]='\0';
987 printf("Partition %d: Filesystem: %s \"%s\"\n"
988 ,cur_part,volinfo.fs_type,vol_label);
994 file_fat_ls(const char *dir)
996 return do_fat_read(dir, NULL, 0, LS_YES);
1001 file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
1003 printf("reading %s\n",filename);
1004 return do_fat_read(filename, buffer, maxsize, LS_NO);