summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/fat.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index b5f6e77837..169672f08e 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -458,11 +458,15 @@ int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector)
458int fat_unmount(int volume, bool flush) 458int fat_unmount(int volume, bool flush)
459{ 459{
460 int rc; 460 int rc;
461#ifdef HAVE_MULTIVOLUME
461 struct bpb* fat_bpb = &fat_bpbs[volume]; 462 struct bpb* fat_bpb = &fat_bpbs[volume];
463#else
464 (void)volume;
465#endif
462 466
463 if(flush) 467 if(flush)
464 { 468 {
465 rc = flush_fat(fat_bpb); /* the clean way, while still alive */ 469 rc = flush_fat(IF_MV(fat_bpb)); /* the clean way, while still alive */
466 } 470 }
467 else 471 else
468 { /* volume is not accessible any more, e.g. MMC removed */ 472 { /* volume is not accessible any more, e.g. MMC removed */
@@ -471,7 +475,11 @@ int fat_unmount(int volume, bool flush)
471 for(i = 0;i < FAT_CACHE_SIZE;i++) 475 for(i = 0;i < FAT_CACHE_SIZE;i++)
472 { 476 {
473 struct fat_cache_entry *fce = &fat_cache[i]; 477 struct fat_cache_entry *fce = &fat_cache[i];
474 if(fce->inuse && fce->fat_vol == fat_bpb) 478 if(fce->inuse
479#ifdef HAVE_MULTIVOLUME
480 && fce->fat_vol == fat_bpb
481#endif
482 )
475 { 483 {
476 fce->inuse = false; /* discard all from that volume */ 484 fce->inuse = false; /* discard all from that volume */
477 fce->dirty = false; 485 fce->dirty = false;
@@ -480,7 +488,9 @@ int fat_unmount(int volume, bool flush)
480 mutex_unlock(&cache_mutex); 488 mutex_unlock(&cache_mutex);
481 rc = 0; 489 rc = 0;
482 } 490 }
491#ifdef HAVE_MULTIVOLUME
483 fat_bpb->mounted = false; 492 fat_bpb->mounted = false;
493#endif
484 return rc; 494 return rc;
485} 495}
486#endif /* #ifdef HAVE_HOTSWAP */ 496#endif /* #ifdef HAVE_HOTSWAP */