diff options
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r-- | firmware/drivers/fat.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index a090bd5899..fed3baffd4 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -1927,7 +1927,7 @@ static int free_direntries(struct bpb *fat_bpb, struct fat_file *file) | |||
1927 | 1927 | ||
1928 | /* directory entry info is now gone */ | 1928 | /* directory entry info is now gone */ |
1929 | file->dircluster = 0; | 1929 | file->dircluster = 0; |
1930 | file->e.entry = FAT_RW_VAL; | 1930 | file->e.entry = FAT_DIRSCAN_RW_VAL; |
1931 | file->e.entries = 0; | 1931 | file->e.entries = 0; |
1932 | 1932 | ||
1933 | return 1; | 1933 | return 1; |
@@ -2521,10 +2521,20 @@ void fat_rewind(struct fat_filestr *filestr) | |||
2521 | filestr->lastcluster = filestr->fatfilep->firstcluster; | 2521 | filestr->lastcluster = filestr->fatfilep->firstcluster; |
2522 | filestr->lastsector = 0; | 2522 | filestr->lastsector = 0; |
2523 | filestr->clusternum = 0; | 2523 | filestr->clusternum = 0; |
2524 | filestr->sectornum = FAT_RW_VAL; | 2524 | filestr->sectornum = FAT_FILE_RW_VAL; |
2525 | filestr->eof = false; | 2525 | filestr->eof = false; |
2526 | } | 2526 | } |
2527 | 2527 | ||
2528 | void fat_seek_to_stream(struct fat_filestr *filestr, | ||
2529 | const struct fat_filestr *filestr_seek_to) | ||
2530 | { | ||
2531 | filestr->lastcluster = filestr_seek_to->lastcluster; | ||
2532 | filestr->lastsector = filestr_seek_to->lastsector; | ||
2533 | filestr->clusternum = filestr_seek_to->clusternum; | ||
2534 | filestr->sectornum = filestr_seek_to->sectornum; | ||
2535 | filestr->eof = filestr_seek_to->eof; | ||
2536 | } | ||
2537 | |||
2528 | int fat_seek(struct fat_filestr *filestr, unsigned long seeksector) | 2538 | int fat_seek(struct fat_filestr *filestr, unsigned long seeksector) |
2529 | { | 2539 | { |
2530 | const struct fat_file * const file = filestr->fatfilep; | 2540 | const struct fat_file * const file = filestr->fatfilep; |
@@ -2536,7 +2546,7 @@ int fat_seek(struct fat_filestr *filestr, unsigned long seeksector) | |||
2536 | long cluster = file->firstcluster; | 2546 | long cluster = file->firstcluster; |
2537 | unsigned long sector = 0; | 2547 | unsigned long sector = 0; |
2538 | long clusternum = 0; | 2548 | long clusternum = 0; |
2539 | unsigned long sectornum = FAT_RW_VAL; | 2549 | unsigned long sectornum = FAT_FILE_RW_VAL; |
2540 | 2550 | ||
2541 | #ifdef HAVE_FAT16SUPPORT | 2551 | #ifdef HAVE_FAT16SUPPORT |
2542 | if (fat_bpb->is_fat16 && cluster < 0) /* FAT16 root dir */ | 2552 | if (fat_bpb->is_fat16 && cluster < 0) /* FAT16 root dir */ |
@@ -2710,7 +2720,7 @@ int fat_readdir(struct fat_filestr *dirstr, struct fat_dirscan_info *scan, | |||
2710 | 2720 | ||
2711 | dc_lock_cache(); | 2721 | dc_lock_cache(); |
2712 | 2722 | ||
2713 | while (--scan->entry != FAT_RW_VAL) /* at beginning? */ | 2723 | while (--scan->entry != FAT_DIRSCAN_RW_VAL) /* at beginning? */ |
2714 | { | 2724 | { |
2715 | ent = cache_direntry(fat_bpb, dirstr, scan->entry); | 2725 | ent = cache_direntry(fat_bpb, dirstr, scan->entry); |
2716 | 2726 | ||
@@ -2761,7 +2771,7 @@ fat_error: | |||
2761 | void fat_rewinddir(struct fat_dirscan_info *scan) | 2771 | void fat_rewinddir(struct fat_dirscan_info *scan) |
2762 | { | 2772 | { |
2763 | /* rewind the directory scan counter to the beginning */ | 2773 | /* rewind the directory scan counter to the beginning */ |
2764 | scan->entry = FAT_RW_VAL; | 2774 | scan->entry = FAT_DIRSCAN_RW_VAL; |
2765 | scan->entries = 0; | 2775 | scan->entries = 0; |
2766 | } | 2776 | } |
2767 | 2777 | ||