diff options
Diffstat (limited to 'firmware/common/dircache.c')
-rw-r--r-- | firmware/common/dircache.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index e642296a35..a50ebe8f30 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c | |||
@@ -1211,6 +1211,19 @@ void dircache_add_file(const char *path, long startcluster) | |||
1211 | entry->startcluster = startcluster; | 1211 | entry->startcluster = startcluster; |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | /* Check if dircache state is still valid. With hotswap, on fs changed, | ||
1215 | * the dircache became invalid but functions coulld be called befire the | ||
1216 | * dircache thread process the message */ | ||
1217 | static void check_dircache_state(void) | ||
1218 | { | ||
1219 | if(check_event_queue()) | ||
1220 | { | ||
1221 | /* Keep this coherent with check_event_queue(). Currently, all the | ||
1222 | * messages that return true will lead to disable. */ | ||
1223 | dircache_initialized = false; | ||
1224 | } | ||
1225 | } | ||
1226 | |||
1214 | DIR_CACHED* opendir_cached(const char* name) | 1227 | DIR_CACHED* opendir_cached(const char* name) |
1215 | { | 1228 | { |
1216 | int dd; | 1229 | int dd; |
@@ -1235,6 +1248,8 @@ DIR_CACHED* opendir_cached(const char* name) | |||
1235 | } | 1248 | } |
1236 | 1249 | ||
1237 | pdir->busy = true; | 1250 | pdir->busy = true; |
1251 | /* check real dircache state */ | ||
1252 | check_dircache_state(); | ||
1238 | 1253 | ||
1239 | if (!dircache_initialized) | 1254 | if (!dircache_initialized) |
1240 | { | 1255 | { |