4 * R/O (V)FAT 12/16/32 filesystem implementation by Marcus Sundberg
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 defined(CONFIG_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(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
89 /* ok, we assume we are on a PBR only */
93 #if (defined(CONFIG_CMD_IDE) || \
94 defined(CONFIG_CMD_SCSI) || \
95 defined(CONFIG_CMD_USB) || \
96 (defined(CONFIG_MMC) && defined(CONFIG_LPC2292)) || \
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)) {
103 /* ok, we assume we are on a PBR only */
107 printf ("** Partition %d not valid on device %d **\n",
108 part_no, dev_desc->dev);
112 if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
113 /* ok, we assume we are on a PBR only */
116 info.start = part_offset;
118 /* FIXME we need to determine the start block of the
119 * partition where the DOS FS resides. This can be done
120 * by using the get_partition_info routine. For this
121 * purpose the libpart must be included.
133 * Get the first occurence of a directory delimiter ('/' or '\') in a string.
134 * Return index into string if found, -1 otherwise.
141 while (*str != '\0') {
142 if (ISDIRDELIM(*str)) return str - start;
150 * Match volume_info fs_type strings.
151 * Return 0 on match, -1 otherwise.
154 compare_sign(char *str1, char *str2)
156 char *end = str1+SIGNLEN;
158 while (str1 != end) {
159 if (*str1 != *str2) {
171 * Extract zero terminated short name from a directory entry.
173 static void get_name (dir_entry *dirent, char *s_name)
177 memcpy (s_name, dirent->name, 8);
180 while (*ptr && *ptr != ' ')
182 if (dirent->ext[0] && dirent->ext[0] != ' ') {
185 memcpy (ptr, dirent->ext, 3);
187 while (*ptr && *ptr != ' ')
191 if (*s_name == DELETED_FLAG)
193 else if (*s_name == aRING)
199 * Get the entry at index 'entry' in a FAT (12/16/32) table.
200 * On failure 0x00 is returned.
203 get_fatent(fsdata *mydata, __u32 entry)
209 switch (mydata->fatsize) {
211 bufnum = entry / FAT32BUFSIZE;
212 offset = entry - bufnum * FAT32BUFSIZE;
215 bufnum = entry / FAT16BUFSIZE;
216 offset = entry - bufnum * FAT16BUFSIZE;
219 bufnum = entry / FAT12BUFSIZE;
220 offset = entry - bufnum * FAT12BUFSIZE;
224 /* Unsupported FAT size */
228 /* Read a new block of FAT entries into the cache. */
229 if (bufnum != mydata->fatbufnum) {
230 int getsize = FATBUFSIZE/FS_BLOCK_SIZE;
231 __u8 *bufptr = mydata->fatbuf;
232 __u32 fatlength = mydata->fatlength;
233 __u32 startblock = bufnum * FATBUFBLOCKS;
235 fatlength *= SECTOR_SIZE; /* We want it in bytes now */
236 startblock += mydata->fat_sect; /* Offset from start of disk */
238 if (getsize > fatlength) getsize = fatlength;
239 if (disk_read(startblock, getsize, bufptr) < 0) {
240 FAT_DPRINT("Error reading FAT blocks\n");
243 mydata->fatbufnum = bufnum;
246 /* Get the actual entry from the table */
247 switch (mydata->fatsize) {
249 ret = FAT2CPU32(((__u32*)mydata->fatbuf)[offset]);
252 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[offset]);
255 __u32 off16 = (offset*3)/4;
258 switch (offset & 0x3) {
260 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
264 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
266 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
268 ret = (val2 << 4) | (val1 >> 12);
271 val1 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);
273 val2 = FAT2CPU16(((__u16*)mydata->fatbuf)[off16+1]);
275 ret = (val2 << 8) | (val1 >> 8);
278 ret = FAT2CPU16(((__u16*)mydata->fatbuf)[off16]);;
279 ret = (ret & 0xfff0) >> 4;
287 FAT_DPRINT("ret: %d, offset: %d\n", ret, offset);
294 * Read at most 'size' bytes from the specified cluster into 'buffer'.
295 * Return 0 on success, -1 otherwise.
298 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
304 startsect = mydata->data_begin + clustnum*mydata->clust_size;
306 startsect = mydata->rootdir_sect;
309 FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
310 if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
311 FAT_DPRINT("Error reading data\n");
314 if(size % FS_BLOCK_SIZE) {
315 __u8 tmpbuf[FS_BLOCK_SIZE];
316 idx= size/FS_BLOCK_SIZE;
317 if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
318 FAT_DPRINT("Error reading data\n");
321 buffer += idx*FS_BLOCK_SIZE;
323 memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
332 * Read at most 'maxsize' bytes from the file associated with 'dentptr'
334 * Return the number of bytes read or -1 on fatal errors.
337 get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
338 unsigned long maxsize)
340 unsigned long filesize = FAT2CPU32(dentptr->size), gotsize = 0;
341 unsigned int bytesperclust = mydata->clust_size * SECTOR_SIZE;
342 __u32 curclust = START(dentptr);
343 __u32 endclust, newclust;
344 unsigned long actsize;
346 FAT_DPRINT("Filesize: %ld bytes\n", filesize);
348 if (maxsize > 0 && filesize > maxsize) filesize = maxsize;
350 FAT_DPRINT("Reading: %ld bytes\n", filesize);
352 actsize=bytesperclust;
355 /* search for consecutive clusters */
356 while(actsize < filesize) {
357 newclust = get_fatent(mydata, endclust);
358 if((newclust -1)!=endclust)
360 if (newclust <= 0x0001 || newclust >= 0xfff0) {
361 FAT_DPRINT("curclust: 0x%x\n", newclust);
362 FAT_DPRINT("Invalid FAT entry\n");
366 actsize+= bytesperclust;
368 /* actsize >= file size */
369 actsize -= bytesperclust;
370 /* get remaining clusters */
371 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
372 FAT_ERROR("Error reading cluster\n");
375 /* get remaining bytes */
376 gotsize += (int)actsize;
380 if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
381 FAT_ERROR("Error reading cluster\n");
387 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
388 FAT_ERROR("Error reading cluster\n");
391 gotsize += (int)actsize;
394 curclust = get_fatent(mydata, endclust);
395 if (curclust <= 0x0001 || curclust >= 0xfff0) {
396 FAT_DPRINT("curclust: 0x%x\n", curclust);
397 FAT_ERROR("Invalid FAT entry\n");
400 actsize=bytesperclust;
406 #ifdef CONFIG_SUPPORT_VFAT
408 * Extract the file name information from 'slotptr' into 'l_name',
409 * starting at l_name[*idx].
410 * Return 1 if terminator (zero byte) is found, 0 otherwise.
413 slot2str(dir_slot *slotptr, char *l_name, int *idx)
417 for (j = 0; j <= 8; j += 2) {
418 l_name[*idx] = slotptr->name0_4[j];
419 if (l_name[*idx] == 0x00) return 1;
422 for (j = 0; j <= 10; j += 2) {
423 l_name[*idx] = slotptr->name5_10[j];
424 if (l_name[*idx] == 0x00) return 1;
427 for (j = 0; j <= 2; j += 2) {
428 l_name[*idx] = slotptr->name11_12[j];
429 if (l_name[*idx] == 0x00) return 1;
438 * Extract the full long filename starting at 'retdent' (which is really
439 * a slot) into 'l_name'. If successful also copy the real directory entry
441 * Return 0 on success, -1 otherwise.
443 __u8 get_vfatname_block[MAX_CLUSTSIZE];
445 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
446 dir_entry *retdent, char *l_name)
449 dir_slot *slotptr = (dir_slot*) retdent;
450 __u8 *nextclust = cluster + mydata->clust_size * SECTOR_SIZE;
451 __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
454 while ((__u8*)slotptr < nextclust) {
455 if (counter == 0) break;
456 if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)
462 if ((__u8*)slotptr >= nextclust) {
466 curclust = get_fatent(mydata, curclust);
467 if (curclust <= 0x0001 || curclust >= 0xfff0) {
468 FAT_DPRINT("curclust: 0x%x\n", curclust);
469 FAT_ERROR("Invalid FAT entry\n");
472 if (get_cluster(mydata, curclust, get_vfatname_block,
473 mydata->clust_size * SECTOR_SIZE) != 0) {
474 FAT_DPRINT("Error: reading directory block\n");
477 slotptr2 = (dir_slot*) get_vfatname_block;
478 while (slotptr2->id > 0x01) {
481 /* Save the real directory entry */
482 realdent = (dir_entry*)slotptr2 + 1;
483 while ((__u8*)slotptr2 >= get_vfatname_block) {
484 slot2str(slotptr2, l_name, &idx);
488 /* Save the real directory entry */
489 realdent = (dir_entry*)slotptr;
494 if (slot2str(slotptr, l_name, &idx)) break;
495 } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
498 if (*l_name == DELETED_FLAG) *l_name = '\0';
499 else if (*l_name == aRING) *l_name = 'å';
502 /* Return the real directory entry */
503 memcpy(retdent, realdent, sizeof(dir_entry));
509 /* Calculate short name checksum */
511 mkcksum(const char *str)
516 for (i = 0; i < 11; i++) {
517 ret = (((ret&1)<<7)|((ret&0xfe)>>1)) + str[i];
526 * Get the directory entry associated with 'filename' from the directory
527 * starting at 'startsect'
529 __u8 get_dentfromdir_block[MAX_CLUSTSIZE];
530 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
531 char *filename, dir_entry * retdent,
534 __u16 prevcksum = 0xffff;
535 __u32 curclust = START (retdent);
536 int files = 0, dirs = 0;
538 FAT_DPRINT ("get_dentfromdir: %s\n", filename);
543 if (get_cluster (mydata, curclust, get_dentfromdir_block,
544 mydata->clust_size * SECTOR_SIZE) != 0) {
545 FAT_DPRINT ("Error: reading directory block\n");
548 dentptr = (dir_entry *) get_dentfromdir_block;
549 for (i = 0; i < DIRENTSPERCLUST; i++) {
550 char s_name[14], l_name[256];
553 if (dentptr->name[0] == DELETED_FLAG) {
557 if ((dentptr->attr & ATTR_VOLUME)) {
558 #ifdef CONFIG_SUPPORT_VFAT
559 if ((dentptr->attr & ATTR_VFAT) &&
560 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
561 prevcksum = ((dir_slot *) dentptr)
563 get_vfatname (mydata, curclust, get_dentfromdir_block,
566 int isdir = (dentptr->attr & ATTR_DIR);
576 if (l_name[0] != 0) {
583 printf (" %8ld %s%c\n",
584 (long) FAT2CPU32 (dentptr->size),
587 printf (" %s%c\n", l_name, dirc);
593 FAT_DPRINT ("vfatname: |%s|\n", l_name);
597 /* Volume label or VFAT entry */
602 if (dentptr->name[0] == 0) {
604 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
606 FAT_DPRINT ("Dentname == NULL - %d\n", i);
609 #ifdef CONFIG_SUPPORT_VFAT
610 if (dols && mkcksum (dentptr->name) == prevcksum) {
615 get_name (dentptr, s_name);
617 int isdir = (dentptr->attr & ATTR_DIR);
627 if (s_name[0] != 0) {
634 printf (" %8ld %s%c\n",
635 (long) FAT2CPU32 (dentptr->size), s_name,
638 printf (" %s%c\n", s_name, dirc);
644 if (strcmp (filename, s_name) && strcmp (filename, l_name)) {
645 FAT_DPRINT ("Mismatch: |%s|%s|\n", s_name, l_name);
649 memcpy (retdent, dentptr, sizeof (dir_entry));
651 FAT_DPRINT ("DentName: %s", s_name);
652 FAT_DPRINT (", start: 0x%x", START (dentptr));
653 FAT_DPRINT (", size: 0x%x %s\n",
654 FAT2CPU32 (dentptr->size),
655 (dentptr->attr & ATTR_DIR) ? "(DIR)" : "");
659 curclust = get_fatent (mydata, curclust);
660 if (curclust <= 0x0001 || curclust >= 0xfff0) {
661 FAT_DPRINT ("curclust: 0x%x\n", curclust);
662 FAT_ERROR ("Invalid FAT entry\n");
672 * Read boot sector and volume info from a FAT filesystem
675 read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
677 __u8 block[FS_BLOCK_SIZE];
678 volume_info *vistart;
680 if (disk_read(0, 1, block) < 0) {
681 FAT_DPRINT("Error: reading block\n");
685 memcpy(bs, block, sizeof(boot_sector));
686 bs->reserved = FAT2CPU16(bs->reserved);
687 bs->fat_length = FAT2CPU16(bs->fat_length);
688 bs->secs_track = FAT2CPU16(bs->secs_track);
689 bs->heads = FAT2CPU16(bs->heads);
691 bs->hidden = FAT2CPU32(bs->hidden);
693 bs->total_sect = FAT2CPU32(bs->total_sect);
696 if (bs->fat_length == 0) {
698 bs->fat32_length = FAT2CPU32(bs->fat32_length);
699 bs->flags = FAT2CPU16(bs->flags);
700 bs->root_cluster = FAT2CPU32(bs->root_cluster);
701 bs->info_sector = FAT2CPU16(bs->info_sector);
702 bs->backup_boot = FAT2CPU16(bs->backup_boot);
703 vistart = (volume_info*) (block + sizeof(boot_sector));
706 vistart = (volume_info*) &(bs->fat32_length);
709 memcpy(volinfo, vistart, sizeof(volume_info));
711 /* Terminate fs_type string. Writing past the end of vistart
712 is ok - it's just the buffer. */
713 vistart->fs_type[8] = '\0';
715 if (*fatsize == 32) {
716 if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
720 if (compare_sign(FAT12_SIGN, vistart->fs_type) == 0) {
724 if (compare_sign(FAT16_SIGN, vistart->fs_type) == 0) {
730 FAT_DPRINT("Error: broken fs_type sign\n");
735 __u8 do_fat_read_block[MAX_CLUSTSIZE]; /* Block buffer */
737 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
740 #if CONFIG_NIOS /* NIOS CPU cannot access big automatic arrays */
743 char fnamecopy[2048];
747 fsdata *mydata = &datablock;
749 __u16 prevcksum = 0xffff;
751 int rootdir_size, cursect;
753 int files = 0, dirs = 0;
757 if (read_bootsectandvi (&bs, &volinfo, &mydata->fatsize)) {
758 FAT_DPRINT ("Error: reading boot sector\n");
761 if (mydata->fatsize == 32) {
762 mydata->fatlength = bs.fat32_length;
764 mydata->fatlength = bs.fat_length;
766 mydata->fat_sect = bs.reserved;
767 cursect = mydata->rootdir_sect
768 = mydata->fat_sect + mydata->fatlength * bs.fats;
769 mydata->clust_size = bs.cluster_size;
770 if (mydata->fatsize == 32) {
771 rootdir_size = mydata->clust_size;
772 mydata->data_begin = mydata->rootdir_sect /* + rootdir_size */
773 - (mydata->clust_size * 2);
775 rootdir_size = ((bs.dir_entries[1] * (int) 256 + bs.dir_entries[0])
776 * sizeof (dir_entry)) / SECTOR_SIZE;
777 mydata->data_begin = mydata->rootdir_sect + rootdir_size
778 - (mydata->clust_size * 2);
780 mydata->fatbufnum = -1;
782 FAT_DPRINT ("FAT%d, fatlength: %d\n", mydata->fatsize,
784 FAT_DPRINT ("Rootdir begins at sector: %d, offset: %x, size: %d\n"
785 "Data begins at: %d\n",
786 mydata->rootdir_sect, mydata->rootdir_sect * SECTOR_SIZE,
787 rootdir_size, mydata->data_begin);
788 FAT_DPRINT ("Cluster size: %d\n", mydata->clust_size);
790 /* "cwd" is always the root... */
791 while (ISDIRDELIM (*filename))
793 /* Make a copy of the filename and convert it to lowercase */
794 strcpy (fnamecopy, filename);
795 downcase (fnamecopy);
796 if (*fnamecopy == '\0') {
800 } else if ((idx = dirdelim (fnamecopy)) >= 0) {
802 fnamecopy[idx] = '\0';
803 subname = fnamecopy + idx + 1;
804 /* Handle multiple delimiters */
805 while (ISDIRDELIM (*subname))
814 if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
815 FAT_DPRINT ("Error: reading rootdir block\n");
818 dentptr = (dir_entry *) do_fat_read_block;
819 for (i = 0; i < DIRENTSPERBLOCK; i++) {
820 char s_name[14], l_name[256];
823 if ((dentptr->attr & ATTR_VOLUME)) {
824 #ifdef CONFIG_SUPPORT_VFAT
825 if ((dentptr->attr & ATTR_VFAT) &&
826 (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
827 prevcksum = ((dir_slot *) dentptr)->alias_checksum;
828 get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
829 if (dols == LS_ROOT) {
830 int isdir = (dentptr->attr & ATTR_DIR);
840 if (l_name[0] != 0) {
847 printf (" %8ld %s%c\n",
848 (long) FAT2CPU32 (dentptr->size),
851 printf (" %s%c\n", l_name, dirc);
857 FAT_DPRINT ("Rootvfatname: |%s|\n", l_name);
861 /* Volume label or VFAT entry */
865 } else if (dentptr->name[0] == 0) {
866 FAT_DPRINT ("RootDentname == NULL - %d\n", i);
867 if (dols == LS_ROOT) {
868 printf ("\n%d file(s), %d dir(s)\n\n", files, dirs);
873 #ifdef CONFIG_SUPPORT_VFAT
874 else if (dols == LS_ROOT
875 && mkcksum (dentptr->name) == prevcksum) {
880 get_name (dentptr, s_name);
881 if (dols == LS_ROOT) {
882 int isdir = (dentptr->attr & ATTR_DIR);
888 if (s_name[0] != 0) {
894 if (s_name[0] != 0) {
901 printf (" %8ld %s%c\n",
902 (long) FAT2CPU32 (dentptr->size), s_name,
905 printf (" %s%c\n", s_name, dirc);
911 if (strcmp (fnamecopy, s_name) && strcmp (fnamecopy, l_name)) {
912 FAT_DPRINT ("RootMismatch: |%s|%s|\n", s_name, l_name);
916 if (isdir && !(dentptr->attr & ATTR_DIR))
919 FAT_DPRINT ("RootName: %s", s_name);
920 FAT_DPRINT (", start: 0x%x", START (dentptr));
921 FAT_DPRINT (", size: 0x%x %s\n",
922 FAT2CPU32 (dentptr->size), isdir ? "(DIR)" : "");
924 goto rootdir_done; /* We got a match */
932 int startsect = mydata->data_begin
933 + START (dentptr) * mydata->clust_size;
935 char *nextname = NULL;
940 idx = dirdelim (subname);
943 nextname = subname + idx + 1;
944 /* Handle multiple delimiters */
945 while (ISDIRDELIM (*nextname))
947 if (dols && *nextname == '\0')
950 if (dols && firsttime) {
957 if (get_dentfromdir (mydata, startsect, subname, dentptr,
958 isdir ? 0 : dols) == NULL) {
965 if (!(dentptr->attr & ATTR_DIR))
970 ret = get_contents (mydata, dentptr, buffer, maxsize);
971 FAT_DPRINT ("Size: %d, got: %ld\n", FAT2CPU32 (dentptr->size), ret);
978 file_fat_detectfs(void)
986 printf("No current device\n");
989 #if defined(CONFIG_CMD_IDE) || \
990 defined(CONFIG_CMD_SCSI) || \
991 defined(CONFIG_CMD_USB) || \
993 printf("Interface: ");
994 switch(cur_dev->if_type) {
995 case IF_TYPE_IDE : printf("IDE"); break;
996 case IF_TYPE_SCSI : printf("SCSI"); break;
997 case IF_TYPE_ATAPI : printf("ATAPI"); break;
998 case IF_TYPE_USB : printf("USB"); break;
999 case IF_TYPE_DOC : printf("DOC"); break;
1000 case IF_TYPE_MMC : printf("MMC"); break;
1001 default : printf("Unknown");
1003 printf("\n Device %d: ",cur_dev->dev);
1006 if(read_bootsectandvi(&bs, &volinfo, &fatsize)) {
1007 printf("\nNo valid FAT fs found\n");
1010 memcpy (vol_label, volinfo.volume_label, 11);
1011 vol_label[11] = '\0';
1012 volinfo.fs_type[5]='\0';
1013 printf("Partition %d: Filesystem: %s \"%s\"\n"
1014 ,cur_part,volinfo.fs_type,vol_label);
1020 file_fat_ls(const char *dir)
1022 return do_fat_read(dir, NULL, 0, LS_YES);
1027 file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
1029 printf("reading %s\n",filename);
1030 return do_fat_read(filename, buffer, maxsize, LS_NO);