Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

mtp-new

By: a guest on May 20th, 2010  |  syntax: Diff  |  size: 1.03 KB  |  views: 118  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
  2. index e642296..a50ebe8 100644
  3. --- a/firmware/common/dircache.c
  4. +++ b/firmware/common/dircache.c
  5. @@ -1211,6 +1211,19 @@ void dircache_add_file(const char *path, long startcluster)
  6.      entry->startcluster = startcluster;
  7.  }
  8.  
  9. +/* Check if dircache state is still valid. With hotswap, on fs changed,
  10. + * the dircache became invalid but functions coulld be called befire the
  11. + * dircache thread process the message */
  12. +static void check_dircache_state(void)
  13. +{
  14. +    if(check_event_queue())
  15. +    {
  16. +        /* Keep this coherent with check_event_queue(). Currently, all the
  17. +         * messages that return true will lead to disable. */
  18. +        dircache_initialized = false;
  19. +    }
  20. +}
  21. +
  22.  DIR_CACHED* opendir_cached(const char* name)
  23.  {
  24.      int dd;
  25. @@ -1235,6 +1248,8 @@ DIR_CACHED* opendir_cached(const char* name)
  26.      }
  27.      
  28.      pdir->busy = true;
  29. +    /* check real dircache state */
  30. +    check_dircache_state();
  31.  
  32.      if (!dircache_initialized)
  33.      {
clone this paste RAW Paste Data