]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/storage/Log/RandRWC.nc
handle full log
[tinyos-2.x.git] / apps / tests / storage / Log / RandRWC.nc
index 4e322de5217791521bc37fd21e6fbf14a32d37f2..7e5ae49ae099b3f4106a9c26c54e8d8be8c9fd13 100644 (file)
  *
  * @author David Gay
  */
-/*
-  address & 3:
-  1: erase, write
-  2: read
-  3: write some more
-*/
 module RandRWC {
   uses {
     interface Boot;
@@ -105,6 +99,8 @@ implementation {
     return b;
   }
 
+  volatile int x;
+
   void setParameters() {
     len = rand() >> 8;
     offset = rand() >> 9;
@@ -143,8 +139,10 @@ implementation {
       }
   }
 
-  event void LogWrite.appendDone(void *buf, storage_len_t y, error_t result) {
-    if (scheck(result))
+  event void LogWrite.appendDone(void *buf, storage_len_t y, bool recordsLost, error_t result) {
+    if (result == ESIZE)
+      scheck(call LogWrite.sync());
+    else if (scheck(result))
       nextWrite();
   }