diff options
Diffstat (limited to 'firmware/common/disk.c')
-rw-r--r-- | firmware/common/disk.c | 27 |
1 files changed, 23 insertions, 4 deletions
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 @@ | |||
23 | #include "storage.h" | 23 | #include "storage.h" |
24 | #include "debug.h" | 24 | #include "debug.h" |
25 | #include "fat.h" | 25 | #include "fat.h" |
26 | #ifdef HAVE_HOTSWAP | ||
27 | #include "dir.h" /* for release_dirs() */ | 26 | #include "dir.h" /* for release_dirs() */ |
28 | #include "file.h" /* for release_files() */ | 27 | #include "file.h" /* for release_files() */ |
29 | #endif | ||
30 | #include "disk.h" | 28 | #include "disk.h" |
31 | #include <string.h> | 29 | #include <string.h> |
32 | 30 | ||
@@ -235,12 +233,13 @@ int disk_mount(int drive) | |||
235 | return mounted; | 233 | return mounted; |
236 | } | 234 | } |
237 | 235 | ||
238 | #ifdef HAVE_HOTSWAP | ||
239 | int disk_unmount(int drive) | 236 | int disk_unmount(int drive) |
240 | { | 237 | { |
241 | int unmounted = 0; | 238 | int unmounted = 0; |
242 | int i; | 239 | int i; |
240 | #ifdef HAVE_HOTSWAP | ||
243 | mutex_lock(&disk_mutex); | 241 | mutex_lock(&disk_mutex); |
242 | #endif | ||
244 | for (i=0; i<NUM_VOLUMES; i++) | 243 | for (i=0; i<NUM_VOLUMES; i++) |
245 | { | 244 | { |
246 | if (vol_drive[i] == drive) | 245 | if (vol_drive[i] == drive) |
@@ -252,8 +251,28 @@ int disk_unmount(int drive) | |||
252 | fat_unmount(i, false); | 251 | fat_unmount(i, false); |
253 | } | 252 | } |
254 | } | 253 | } |
254 | #ifdef HAVE_HOTSWAP | ||
255 | mutex_unlock(&disk_mutex); | 255 | mutex_unlock(&disk_mutex); |
256 | #endif | ||
257 | |||
258 | return unmounted; | ||
259 | } | ||
260 | |||
261 | int disk_unmount_all(void) | ||
262 | { | ||
263 | #ifndef HAVE_MULTIDRIVE | ||
264 | return disk_unmount(0); | ||
265 | #else /* HAVE_MULTIDRIVE */ | ||
266 | int unmounted = 0; | ||
267 | int i; | ||
268 | for (i = 0; i < NUM_DRIVES; i++) | ||
269 | { | ||
270 | #ifdef HAVE_HOTSWAP | ||
271 | if (storage_present(i)) | ||
272 | #endif | ||
273 | unmounted += disk_unmount(i); | ||
274 | } | ||
256 | 275 | ||
257 | return unmounted; | 276 | return unmounted; |
277 | #endif /* HAVE_MULTIDRIVE */ | ||
258 | } | 278 | } |
259 | #endif /* #ifdef HAVE_HOTSWAP */ | ||