From 1db3dfdd759476ae4930958ec775fd2009674091 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Sun, 28 Nov 2010 15:22:51 +0000 Subject: Accept FS#11774 by Michael Hohmuth (with some own modifications to #ifdef conditions) Unmount all filesystems before connecting USB. This ensures that all filehandles are closed, which avoids possible filesystem corruption git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28693 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/disk.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'firmware/common/disk.c') diff --git a/firmware/common/disk.c b/firmware/common/disk.c index 6be9b47379..400d21f359 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -23,10 +23,8 @@ #include "storage.h" #include "debug.h" #include "fat.h" -#ifdef HAVE_HOTSWAP #include "dir.h" /* for release_dirs() */ #include "file.h" /* for release_files() */ -#endif #include "disk.h" #include @@ -235,12 +233,13 @@ int disk_mount(int drive) return mounted; } -#ifdef HAVE_HOTSWAP int disk_unmount(int drive) { int unmounted = 0; int i; +#ifdef HAVE_HOTSWAP mutex_lock(&disk_mutex); +#endif for (i=0; i