[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    Fix logdisk
From:       gerrit () rockbox ! org
Date:       2013-08-16 20:00:05
Message-ID: 201308162000.r7GK05xO008877 () giant ! haxx ! se
[Download RAW message or body]

commit c13f21a4d5c27c638c9f0dedf6d7b1f9bbb4d682
Author: Amaury Pouly <amaury.pouly@gmail.com>
Date:   Fri Aug 16 21:55:09 2013 +0200

    Fix logdisk
    
    The code was broken in a subtle but crucial way: storage idle
    callbacks are oneshot so after the first flush everything would
    stay in the buffer forever and would never be written to the disk
    thus resulting into many events being lost. This changed correctly
    registers the idle callback each time the buffer is not empty.
    Note that the idle storage code checks if a callback
    has is in the queue already so we don't register twice.
    
    Change-Id: Ifdf331d4b757e05b8a6902bf5926cbc7689f5109

diff --git a/apps/main.c b/apps/main.c
index 7333f7d..7dc6175 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -489,10 +489,6 @@ static void init(void)
 #endif
 #endif
 
-#ifdef ROCKBOX_HAS_LOGDISKF
-    init_logdiskf();
-#endif
-
 #if CONFIG_RTC
     rtc_init();
 #endif
diff --git a/firmware/logf.c b/firmware/logf.c
index e135b0b..fadfc9b 100644
--- a/firmware/logf.c
+++ b/firmware/logf.c
@@ -273,6 +273,8 @@ static int logdiskf_push(void *userp, unsigned char c)
     return true;
 }
 
+static void flush_buffer(void* data);
+
 void _logdiskf(const char* file, const char level, const char *fmt, ...)
 {
 
@@ -296,9 +298,9 @@ void _logdiskf(const char* file, const char level, const char *fmt, ...)
 
     vuprintf(logdiskf_push, NULL, fmt, ap);
     va_end(ap);
-
-
+    register_storage_idle_func(flush_buffer);
 }
+
 static void flush_buffer(void* data)
 {
     (void)data;
@@ -316,8 +318,4 @@ static void flush_buffer(void* data)
     logdiskfindex = 0;
 }
 
-void init_logdiskf()
-{
-    register_storage_idle_func(flush_buffer);
-}
 #endif
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic