[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/rincon/apps/Blackbook5/core NodeShopM.nc, 1.1, 1.2 WriteAllocM.nc, 1.2, 1.3 CheckpointM.nc, 1.2, 1.3 FileioC.nc, 1.2, 1.3 BFileReadM.nc, 1.2, 1.3 BDictionaryM.nc, 1.2, 1.3 Blackbook.h, 1.2, 1.3 BFileWriteM.nc, 1.2, 1.3 SectorMapM.nc, 1.2, 1.3 BFileDirM.nc, 1.1, 1.2 NodeMapM.nc, 1.2, 1.3 BFileDeleteM.nc, 1.2, 1.3 CheckpointDummyM.nc, 1.1, 1.2 FileioM.nc, 1.2, 1.3

dmm rincon at users.sourceforge.net
Thu Sep 28 10:32:30 PDT 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14770/contrib/rincon/apps/Blackbook5/core

Modified Files:
	NodeShopM.nc WriteAllocM.nc CheckpointM.nc FileioC.nc 
	BFileReadM.nc BDictionaryM.nc Blackbook.h BFileWriteM.nc 
	SectorMapM.nc BFileDirM.nc NodeMapM.nc BFileDeleteM.nc 
	CheckpointDummyM.nc FileioM.nc 
Log Message:
Updated to Blackbook v.5.2

Index: NodeShopM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/NodeShopM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NodeShopM.nc	18 May 2006 22:34:20 -0000	1.1
--- NodeShopM.nc	28 Sep 2006 17:31:37 -0000	1.2
***************
*** 50,55 ****
  implementation {
  
!   /** Pointer to the current node */
!   node *currentNode;
    
    /** Pointer to the current file */
--- 50,55 ----
  implementation {
  
!   /** Pointer to the current flashnode */
!   flashnode *currentNode;
    
    /** Pointer to the current file */
***************
*** 74,84 ****
    
    /***************** Prototypes ****************/
!   /** Delete the current node */
    task void deleteMyNode();
    
!   /** Write the nodemeta for the current node to flash */
    task void writeNodemeta();
    
!   /** Write the filemeta for the current node to flash */
    task void writeFilemeta();
      
--- 74,84 ----
    
    /***************** Prototypes ****************/
!   /** Delete the current flashnode */
    task void deleteMyNode();
    
!   /** Write the nodemeta for the current flashnode to flash */
    task void writeNodemeta();
    
!   /** Write the filemeta for the current flashnode to flash */
    task void writeFilemeta();
      
***************
*** 86,90 ****
    task void flush();
    
!   /** Get the CRC of the data in the current node */
    task void getMyNodeCrc();
    
--- 86,90 ----
    task void flush();
    
!   /** Get the CRC of the data in the current flashnode */
    task void getMyNodeCrc();
    
***************
*** 99,106 ****
     * Write the nodemeta to flash for the given node
     * @param focusedFile - the file
!    * @param focusedNode - the node to write the nodemeta for
     * @param name - pointer to the filename
     */
!   command result_t NodeShop.writeNodemeta(file *focusedFile, node *focusedNode, filename *name) {
      if(!call State.requestState(S_WRITE_NODEMETA)) {
        return FAIL;
--- 99,106 ----
     * Write the nodemeta to flash for the given node
     * @param focusedFile - the file
!    * @param focusedNode - the flashnode to write the nodemeta for
     * @param name - pointer to the filename
     */
!   command result_t NodeShop.writeNodemeta(file *focusedFile, flashnode *focusedNode, filename *name) {
      if(!call State.requestState(S_WRITE_NODEMETA)) {
        return FAIL;
***************
*** 129,135 ****
  
    /**
!    * Delete a node on flash. This will not erase the
     * data from flash, but it will simply mark the magic
!    * number of the node to make it invalid.
     * 
     * After the command is called and executed, a metaDeleted
--- 129,135 ----
  
    /**
!    * Delete a flashnode on flash. This will not erase the
     * data from flash, but it will simply mark the magic
!    * number of the flashnode to make it invalid.
     * 
     * After the command is called and executed, a metaDeleted
***************
*** 138,142 ****
     * @return SUCCESS if the magic number will be marked
     */
!   command result_t NodeShop.deleteNode(node *focusedNode) { 
      if(!call State.requestState(S_NODEMETA_DELETE)) {
        return FAIL;
--- 138,142 ----
     * @return SUCCESS if the magic number will be marked
     */
!   command result_t NodeShop.deleteNode(flashnode *focusedNode) { 
      if(!call State.requestState(S_NODEMETA_DELETE)) {
        return FAIL;
***************
*** 150,163 ****
    
    /**
!    * Get the CRC of a node on flash.
     *
     * After the command is called and executed, a crcCalculated
     * event will be signaled.
     *
!    * @param focusedNode - the node to read and calculate a CRC for
     * @param focusedFile - the file belonging to the node
     * @return SUCCESS if the CRC will be calculated.
     */
!   command result_t NodeShop.getCrc(node *focusedNode, file *focusedFile) {
      if(!call State.requestState(S_CRC)) {
        return FAIL;
--- 150,163 ----
    
    /**
!    * Get the CRC of a flashnode on flash.
     *
     * After the command is called and executed, a crcCalculated
     * event will be signaled.
     *
!    * @param focusedNode - the flashnode to read and calculate a CRC for
     * @param focusedFile - the file belonging to the node
     * @return SUCCESS if the CRC will be calculated.
     */
!   command result_t NodeShop.getCrc(flashnode *focusedNode, file *focusedFile) {
      if(!call State.requestState(S_CRC)) {
        return FAIL;

Index: WriteAllocM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/WriteAllocM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** WriteAllocM.nc	6 Jun 2006 16:50:29 -0000	1.2
--- WriteAllocM.nc	28 Sep 2006 17:31:38 -0000	1.3
***************
*** 32,38 ****
   * it will be allocated in both the NodeMap and on flash and created.
   * In the end, if enough space exists and the file is created successfully,
!  * the node that can be written to in the file will be passed back.
!  * When whatever component fills that node completely and wants to keep
!  * writing, it will need to load up the next node in the file if it exists.
   * @author David Moss - dmm at rincon.com
   */
--- 32,38 ----
   * it will be allocated in both the NodeMap and on flash and created.
   * In the end, if enough space exists and the file is created successfully,
!  * the flashnode that can be written to in the file will be passed back.
!  * When whatever component fills that flashnode completely and wants to keep
!  * writing, it will need to load up the next flashnode in the file if it exists.
   * @author David Moss - dmm at rincon.com
   */
***************
*** 59,64 ****
    file *currentFile;
    
!   /** The node we're working on */
!   node *currentNode;
    
    /** The current sector we're looking at */
--- 59,64 ----
    file *currentFile;
    
!   /** The flashnode we're working on */
!   flashnode *currentNode;
    
    /** The current sector we're looking at */
***************
*** 80,87 ****
    bool constructing;
    
!   /** TRUE if we are to only allocate one node for the file */
    bool onlyOneNode;
    
!   /** The element number to set for the next allocated node */
    uint8_t nextElement;
    
--- 80,87 ----
    bool constructing;
    
!   /** TRUE if we are to only allocate one flashnode for the file */
    bool onlyOneNode;
    
!   /** The element number to set for the next allocated flashnode */
    uint8_t nextElement;
    
***************
*** 111,115 ****
    void closeCurrentFile();
   
!   /** Find and unfinalize (if necessary) the first writable node of a file */
    void getWritableNode(); 
    
--- 111,115 ----
    void closeCurrentFile();
   
!   /** Find and unfinalize (if necessary) the first writable flashnode of a file */
    void getWritableNode(); 
    
***************
*** 122,126 ****
     */
    command result_t WriteAlloc.openForWriting(char *fileName, uint32_t minimumSize, bool forceConstruction, bool oneNode) {
!     node *lastNode;
      if(!call State.requestState(S_OPEN)) {
        return FAIL;
--- 122,126 ----
     */
    command result_t WriteAlloc.openForWriting(char *fileName, uint32_t minimumSize, bool forceConstruction, bool oneNode) {
!     flashnode *lastNode;
      if(!call State.requestState(S_OPEN)) {
        return FAIL;
***************
*** 169,173 ****
        currentNode = currentFile->firstNode;
  
!       // Traverse through each existing node of the file.
        do {
          if(oneNode) {
--- 169,173 ----
        currentNode = currentFile->firstNode;
  
!       // Traverse through each existing flashnode of the file.
        do {
          if(oneNode) {
***************
*** 185,189 ****
        } while((currentNode = currentNode->nextNode) != NULL);
        
!       // 'lastNode' now contains the last node of the file.
        // 'currentNode' now contains NULL
        
--- 185,189 ----
        } while((currentNode = currentNode->nextNode) != NULL);
        
!       // 'lastNode' now contains the last flashnode of the file.
        // 'currentNode' now contains NULL
        
***************
*** 218,225 ****
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the node that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(node *focusedNode, result_t result) {
      if(call State.getState() == S_OPEN) {
        finishResult = SUCCESS;
--- 218,225 ----
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the flashnode that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(flashnode *focusedNode, result_t result) {
      if(call State.getState() == S_OPEN) {
        finishResult = SUCCESS;
***************
*** 238,252 ****
    
    /**
!    * A node was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the node that was deleted.
!    * @param result - SUCCESS if the node was deleted successfully.
     */
!   event void NodeShop.metaDeleted(node *focusedNode, result_t result) {
    }
   
    /**
!    * A crc was calculated from node data on flash
!    * @param dataCrc - the crc of the data read from the node on flash.
     * @param result - SUCCESS if the crc is valid
     */
--- 238,252 ----
    
    /**
!    * A flashnode was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the flashnode that was deleted.
!    * @param result - SUCCESS if the flashnode was deleted successfully.
     */
!   event void NodeShop.metaDeleted(flashnode *focusedNode, result_t result) {
    }
   
    /**
!    * A crc was calculated from flashnode data on flash
!    * @param dataCrc - the crc of the data read from the flashnode on flash.
     * @param result - SUCCESS if the crc is valid
     */
***************
*** 265,269 ****
     */
    event void BClean.gcDone(result_t result) {
!     node *lastGoodNode;
      if(call State.getState() == S_OPEN) {
        if(!result) {
--- 265,269 ----
     */
    event void BClean.gcDone(result_t result) {
!     flashnode *lastGoodNode;
      if(call State.getState() == S_OPEN) {
        if(!result) {
***************
*** 275,279 ****
        
        // 1. Erase all the current temporary nodes
!       //    and find the last non-temporary node of the file
        currentNode = currentFile->firstNode;
        lastGoodNode = NULL;
--- 275,279 ----
        
        // 1. Erase all the current temporary nodes
!       //    and find the last non-temporary flashnode of the file
        currentNode = currentFile->firstNode;
        lastGoodNode = NULL;
***************
*** 304,308 ****
      
        
!       // 2. Allocate a node to the file
        if((currentNode = call NodeBooter.requestAddNode()) == NULL) {
          fail();
--- 304,308 ----
      
        
!       // 2. Allocate a flashnode to the file
        if((currentNode = call NodeBooter.requestAddNode()) == NULL) {
          fail();
***************
*** 330,334 ****
    /***************** Tasks ****************/
    /**
!    * A node has already been reserved in the NodeMap,
     * this task will allocate space on flash for the node.
     */
--- 330,334 ----
    /***************** Tasks ****************/
    /**
!    * A flashnode has already been reserved in the NodeMap,
     * this task will allocate space on flash for the node.
     */
***************
*** 372,376 ****
     */
    result_t allocateOneSector() {
!     node *lastNode;
      uint8_t metaSize = sizeof(nodemeta);
      
--- 372,376 ----
     */
    result_t allocateOneSector() {
!     flashnode *lastNode;
      uint8_t metaSize = sizeof(nodemeta);
      
***************
*** 429,436 ****
    
    /**
!    * Find the first writable node of the file. If it needs
     * to be unfinalized, unfinalize it.  Finish up by
     * signaling completion with the first writable unfinalized node.
!    * The app will write to the node after the node's dataLength
     * location.
     */
--- 429,436 ----
    
    /**
!    * Find the first writable flashnode of the file. If it needs
     * to be unfinalized, unfinalize it.  Finish up by
     * signaling completion with the first writable unfinalized node.
!    * The app will write to the flashnode after the node's dataLength
     * location.
     */
***************
*** 443,447 ****
        totalSize += currentNode->dataLength;
        
!       // Traverse through each existing node of the file.
        // Find the first writable node.
        // Checkpoint files, on boot, will still be in state NODE_BOOTING,
--- 443,447 ----
        totalSize += currentNode->dataLength;
        
!       // Traverse through each existing flashnode of the file.
        // Find the first writable node.
        // Checkpoint files, on boot, will still be in state NODE_BOOTING,

Index: CheckpointM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/CheckpointM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CheckpointM.nc	7 Jun 2006 19:34:17 -0000	1.2
--- CheckpointM.nc	28 Sep 2006 17:31:38 -0000	1.3
***************
*** 63,68 ****
    uint16_t dictionaryHeaderBuffer;
  
!   /** Current node to repair */  
!   node *currentNode;
   
    /** Checkpoint States */
--- 63,68 ----
    uint16_t dictionaryHeaderBuffer;
  
!   /** Current flashnode to repair */  
!   flashnode *currentNode;
   
    /** Checkpoint States */
***************
*** 118,125 ****
    /**
     * Update a node.
!    * @param focusedNode - the node to save or delete
     * @return SUCCESS if the information will be updated
     */
!   command result_t Checkpoint.update(node *focusedNode) {
      if(!call State.requestState(S_UPDATE)) {
        return FAIL;
--- 118,125 ----
    /**
     * Update a node.
!    * @param focusedNode - the flashnode to save or delete
     * @return SUCCESS if the information will be updated
     */
!   command result_t Checkpoint.update(flashnode *focusedNode) {
      if(!call State.requestState(S_UPDATE)) {
        return FAIL;
***************
*** 134,138 ****
      
      if(currentNode->state == NODE_VALID) {
!       // This node needs to be saved.
        currentCheckpoint.filenameCrc = currentNode->filenameCrc;
        currentCheckpoint.dataCrc = currentNode->dataCrc;
--- 134,138 ----
      
      if(currentNode->state == NODE_VALID) {
!       // This flashnode needs to be saved.
        currentCheckpoint.filenameCrc = currentNode->filenameCrc;
        currentCheckpoint.dataCrc = currentNode->dataCrc;
***************
*** 149,153 ****
        
      } else if(currentNode->state == NODE_DELETED) {
!       // This node should be removed from the Checkpoint.
        if(!call BDictionary.remove(currentNode->flashAddress)) {
          call State.toIdle();
--- 149,153 ----
        
      } else if(currentNode->state == NODE_DELETED) {
!       // This flashnode should be removed from the Checkpoint.
        if(!call BDictionary.remove(currentNode->flashAddress)) {
          call State.toIdle();
***************
*** 168,177 ****
     * from the Checkpoint.
     *
!    * If the node cannot be recovered, it is deleted.
     *
!    * @param focusedNode - the node to recover, with client set to its element number
     * @return SUCCESS if recovery will proceed
     */
!   command result_t Checkpoint.recover(node *focusedNode) {
      if(!call State.requestState(S_RECOVER)) {
        return FAIL;
--- 168,177 ----
     * from the Checkpoint.
     *
!    * If the flashnode cannot be recovered, it is deleted.
     *
!    * @param focusedNode - the flashnode to recover, with client set to its element number
     * @return SUCCESS if recovery will proceed
     */
!   command result_t Checkpoint.recover(flashnode *focusedNode) {
      if(!call State.requestState(S_RECOVER)) {
        return FAIL;
***************
*** 286,297 ****
    }
    
    /***************** NodeShop Events ****************/
    
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the node that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(node *focusedNode, result_t result) {
    }
    
--- 286,300 ----
    }
    
+   event void BDictionary.totalKeys(uint16_t totalKeys) {
+   }
+   
    /***************** NodeShop Events ****************/
    
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the flashnode that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(flashnode *focusedNode, result_t result) {
    }
    
***************
*** 306,315 ****
    
    /**
!    * A node was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the node that was deleted.
!    * @param result - SUCCESS if the node was deleted successfully.
     */
!   event void NodeShop.metaDeleted(node *focusedNode, result_t result) {
      file *focusedFile;
      
--- 309,318 ----
    
    /**
!    * A flashnode was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the flashnode that was deleted.
!    * @param result - SUCCESS if the flashnode was deleted successfully.
     */
!   event void NodeShop.metaDeleted(flashnode *focusedNode, result_t result) {
      file *focusedFile;
      
***************
*** 327,332 ****
   
    /**
!    * A crc was calculated from node data on flash
!    * @param dataCrc - the crc of the data read from the node on flash.
     * @param result - SUCCESS if the crc is valid
     */
--- 330,335 ----
   
    /**
!    * A crc was calculated from flashnode data on flash
!    * @param dataCrc - the crc of the data read from the flashnode on flash.
     * @param result - SUCCESS if the crc is valid
     */

Index: FileioC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/FileioC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FileioC.nc	6 Jun 2006 16:50:29 -0000	1.2
--- FileioC.nc	28 Sep 2006 17:31:39 -0000	1.3
***************
*** 41,45 ****
  implementation {
    components FileioM, FlashBridgeC, NodeShopC, NodeMapC, StateC, GenericCrcC;
! 
    Fileio = FileioM;
    StdControl = FlashBridgeC;
--- 41,45 ----
  implementation {
    components FileioM, FlashBridgeC, NodeShopC, NodeMapC, StateC, GenericCrcC;
!   
    Fileio = FileioM;
    StdControl = FlashBridgeC;
***************
*** 50,53 ****
    FileioM.NodeMap -> NodeMapC; 
    FileioM.State -> StateC.State[unique("State")];
- 
  }
--- 50,52 ----

Index: BFileReadM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/BFileReadM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BFileReadM.nc	7 Jun 2006 19:34:17 -0000	1.2
--- BFileReadM.nc	28 Sep 2006 17:31:40 -0000	1.3
***************
*** 56,60 ****
      file *openFile;
      
!     /** The position to read from in the current open node */
      uint32_t readAddress;
    
--- 56,60 ----
      file *openFile;
      
!     /** The position to read from in the current open flashnode */
      uint32_t readAddress;
    
***************
*** 103,107 ****
      if(readers[currentClient].openFile == NULL) {
        if((readers[currentClient].openFile = call NodeMap.getFile(&currentFilename)) != NULL) {
!         readers[currentClient].openFile->state = FILE_READING;
          readers[currentClient].readAddress = 0;
          call BlackbookState.toIdle();    
--- 103,110 ----
      if(readers[currentClient].openFile == NULL) {
        if((readers[currentClient].openFile = call NodeMap.getFile(&currentFilename)) != NULL) {
!         if(readers[currentClient].openFile->state == FILE_IDLE) {
!           // We set it to READING only to prevent this file from being deleted.
!           readers[currentClient].openFile->state = FILE_READING;
!         }
          readers[currentClient].readAddress = 0;
          call BlackbookState.toIdle();    
***************
*** 109,117 ****
          return SUCCESS;
        }
!     }    
      
      call BlackbookState.toIdle();
      return FAIL;
    }
  
    /**
--- 112,133 ----
          return SUCCESS;
        }
!       
!     } else {
!       // File already open
!       call BlackbookState.toIdle();
!       signal BFileRead.opened[currentClient](call NodeMap.getDataLength(readers[currentClient].openFile), SUCCESS);
!       return SUCCESS;
!     }
      
      call BlackbookState.toIdle();
      return FAIL;
    }
+   
+   /**
+    * @return TRUE if the given parameterized interface has a file open
+    */
+   command bool BFileRead.isOpen[uint8_t id]() {
+     return (readers[id].openFile != NULL);
+   }
  
    /**
***************
*** 119,124 ****
     */
    command result_t BFileRead.close[uint8_t id]() {
      if(readers[currentClient].openFile != NULL) {
!       readers[currentClient].openFile->state = FILE_IDLE;
      }
      
--- 135,144 ----
     */
    command result_t BFileRead.close[uint8_t id]() {
+     currentClient = id;
      if(readers[currentClient].openFile != NULL) {
!       // Set the file to IDLE only if it was IDLE to begin with.
!       if(readers[currentClient].openFile->state == FILE_READING) {
!         readers[currentClient].openFile->state = FILE_IDLE;
!       }
      }
      
***************
*** 202,206 ****
    
    /**
!    * Data was appended to the node in the flash.
     * @param writeBuffer - pointer to the buffer containing the data written
     * @param amountWritten - the amount of data appended to the node.
--- 222,226 ----
    
    /**
!    * Data was appended to the flashnode in the flash.
     * @param writeBuffer - pointer to the buffer containing the data written
     * @param amountWritten - the amount of data appended to the node.

Index: BDictionaryM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/BDictionaryM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BDictionaryM.nc	7 Jun 2006 19:34:17 -0000	1.2
--- BDictionaryM.nc	28 Sep 2006 17:31:40 -0000	1.3
***************
*** 134,137 ****
--- 134,140 ----
    uint8_t valueBuffer[VALUE_COPY_BUFFER_LENGTH];
    
+   /** getTotalKeys: The total valid keys in this open dictionary file */
+   uint16_t totalKeys;
+   
    /**
     * CommandState states
***************
*** 159,162 ****
--- 162,168 ----
      S_COMMAND_NEXTKEY,
      
+     /** getTotalKey command received */
+     S_COMMAND_TOTALKEYS,
+     
    };
      
***************
*** 338,343 ****
      
      if(clients[currentClient].dictionaryFile != NULL) {
        resetStates();
!       return FAIL;
      }
      
--- 344,351 ----
      
      if(clients[currentClient].dictionaryFile != NULL) {
+       // File already open
        resetStates();
!       signal BDictionary.opened[currentClient](call NodeMap.getReserveLength(clients[currentClient].dictionaryFile), call NodeMap.getReserveLength(clients[currentClient].dictionaryFile) - clients[currentClient].writeOffset, SUCCESS);
!       return SUCCESS;
      }
      
***************
*** 347,350 ****
--- 355,404 ----
    
    /**
+    * @return TRUE if the given parameterized interface has a file open
+    */
+   command bool BDictionary.isOpen[uint8_t id]() {
+     return (clients[id].dictionaryFile != NULL);
+   }
+   
+   /**
+    * Because Dictionary files are special, and NodeMap does not give an
+    * accurate reflection of what's going on with Dictionary file sizes,
+    * this command will return the size of the Dictionary file up to the
+    * point where valid data ends.
+    * @return the size of the valid data in the open dictionary file
+    */
+   command uint32_t BDictionary.getFileLength[uint8_t id]() {
+     if(clients[id].dictionaryFile != NULL) {
+       return clients[id].writeOffset;
+     }
+     
+     return 0;
+   }
+   
+   
+   /**
+    * @return the total valid keys in the open dictionary file
+    */
+   command result_t BDictionary.getTotalKeys[uint8_t id]() {
+     if(id != INTERNAL_DICTIONARY) {
+       if(!call BlackbookState.requestState(S_DICTIONARY_BUSY)) {
+         return FAIL;
+       }
+     }
+     
+     call CommandState.forceState(S_COMMAND_TOTALKEYS);
+     currentClient = id;
+     totalKeys = 0;
+   
+     if(clients[currentClient].dictionaryFile != NULL) {
+       searchForValidKey();
+       return SUCCESS;
+     }
+     
+     resetStates();
+     return FAIL;
+   }
+   
+   /**
     * Close any opened BDictionary files
     * @return SUCCESS if the open BDictionary file was closed.
***************
*** 366,373 ****
     *
     *   Check to see if the remaining write space in the
!    *   client's open node is less than the size of the key + value.
     *      
     *      If there isn't enough space:
!    *        A. First evaluate the node to see if we can solve the 
     *           problem by creating a new node.  If enough space would
     *           exist in the file by removing the invalid keys, then continue:
--- 420,427 ----
     *
     *   Check to see if the remaining write space in the
!    *   client's open flashnode is less than the size of the key + value.
     *      
     *      If there isn't enough space:
!    *        A. First evaluate the flashnode to see if we can solve the 
     *           problem by creating a new node.  If enough space would
     *           exist in the file by removing the invalid keys, then continue:
***************
*** 670,677 ****
     * The write open process completed
     * @param openFile - the file that was opened for writing 
!    * @param writeNode - the node to write to
     * @param result - SUCCESS if the file was correctly opened
     */
!   event void WriteAlloc.openedForWriting(file *openFile, node *writeNode, uint32_t totalSize, result_t result) {
      if(call CommandState.getState() == S_COMMAND_OPEN) {
        if(result) {
--- 724,731 ----
     * The write open process completed
     * @param openFile - the file that was opened for writing 
!    * @param writeNode - the flashnode to write to
     * @param result - SUCCESS if the file was correctly opened
     */
!   event void WriteAlloc.openedForWriting(file *openFile, flashnode *writeNode, uint32_t totalSize, result_t result) {
      if(call CommandState.getState() == S_COMMAND_OPEN) {
        if(result) {
***************
*** 708,712 ****
    /***************** Fileio Events ****************/
      /**
!    * Data was appended to the node in the flash.
     * @param writeBuffer - pointer to the buffer containing the data written
     * @param amountWritten - the amount of data appended to the node.
--- 762,766 ----
    /***************** Fileio Events ****************/
      /**
!    * Data was appended to the flashnode in the flash.
     * @param writeBuffer - pointer to the buffer containing the data written
     * @param amountWritten - the amount of data appended to the node.
***************
*** 877,884 ****
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the node that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(node *focusedNode, result_t result) {
      if(call DictionaryState.getState() == S_INSERT_CHANGEFILES) {
        // Done turning our constructing file into a valid file. Now delete
--- 931,938 ----
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the flashnode that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(flashnode *focusedNode, result_t result) {
      if(call DictionaryState.getState() == S_INSERT_CHANGEFILES) {
        // Done turning our constructing file into a valid file. Now delete
***************
*** 901,910 ****
    
    /**
!    * A node was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the node that was deleted.
!    * @param result - SUCCESS if the node was deleted successfully.
     */
!   event void NodeShop.metaDeleted(node *focusedNode, result_t result) {
      if(call DictionaryState.getState() == S_INSERT_CHANGEFILES) {
        focusedNode->state = NODE_EMPTY;
--- 955,964 ----
    
    /**
!    * A flashnode was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the flashnode that was deleted.
!    * @param result - SUCCESS if the flashnode was deleted successfully.
     */
!   event void NodeShop.metaDeleted(flashnode *focusedNode, result_t result) {
      if(call DictionaryState.getState() == S_INSERT_CHANGEFILES) {
        focusedNode->state = NODE_EMPTY;
***************
*** 917,922 ****
   
    /**
!    * A crc was calculated from node data on flash
!    * @param dataCrc - the crc of the data read from the node on flash.
     * @param result - SUCCESS if the crc is valid
     */
--- 971,976 ----
   
    /**
!    * A crc was calculated from flashnode data on flash
!    * @param dataCrc - the crc of the data read from the flashnode on flash.
     * @param result - SUCCESS if the crc is valid
     */
***************
*** 1201,1205 ****
      call SearchState.forceState(S_FIND_VALIDKEY);
      post keySearchLoop();
-     
    }
    
--- 1255,1258 ----
***************
*** 1305,1308 ****
--- 1358,1372 ----
        signal BDictionary.nextKey[currentClient](keyBuffer.key, result); 
      
+     } else if(call CommandState.getState() == S_COMMAND_TOTALKEYS) {
+       if(result) {
+         totalKeys++;
+         call SearchState.forceState(S_FIND_VALIDKEY);
+         continueSearch();
+         
+       } else {
+         resetStates();
+         signal BDictionary.totalKeys[currentClient](totalKeys);
+       }
+       
      } else if(call CommandState.getState() == S_COMMAND_INSERT) {
        if(result) {
***************
*** 1316,1324 ****
          call DictionaryState.forceState(S_INSERT_KEYCOPY);
          call Fileio.writeData(currentFile, currentWriteOffset, &keyBuffer, sizeof(keymeta));
!         
        } else {
          // We're done finding valid keys in the old file.
!         // 1. Change the state of our new file's node to VALID
!         // 2. Write the metadata to flash to reflect that node is valid
          //    If a catastrophic failure occurs here, 2 valid files with
          //    the same name will be found on flash.  Either one can
--- 1380,1388 ----
          call DictionaryState.forceState(S_INSERT_KEYCOPY);
          call Fileio.writeData(currentFile, currentWriteOffset, &keyBuffer, sizeof(keymeta));
!       
        } else {
          // We're done finding valid keys in the old file.
!         // 1. Change the state of our new file's flashnode to VALID
!         // 2. Write the metadata to flash to reflect that flashnode is valid
          //    If a catastrophic failure occurs here, 2 valid files with
          //    the same name will be found on flash.  Either one can
***************
*** 1424,1428 ****
    
    default event void BDictionary.fileIsDictionary[uint8_t id](bool isDictionary, result_t result) {
!   } 
  }
  
--- 1488,1496 ----
    
    default event void BDictionary.fileIsDictionary[uint8_t id](bool isDictionary, result_t result) {
!   }
!   
!   default event void BDictionary.totalKeys[uint8_t id](uint16_t keys) {
!   }
!   
  }
  

Index: Blackbook.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/Blackbook.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Blackbook.h	6 Jun 2006 16:50:29 -0000	1.2
--- Blackbook.h	28 Sep 2006 17:31:40 -0000	1.3
***************
*** 24,27 ****
--- 24,30 ----
   */
  
+ #ifndef blackbook
+ #define blackbook
+ 
  /**
   * Blackbook Definitions v.3
***************
*** 46,50 ****
  /** 
   * This is the nodemeta information kept at the start of each 
!  * node on flash
   */
  typedef struct nodemeta {
--- 49,53 ----
  /** 
   * This is the nodemeta information kept at the start of each 
!  * flashnode on flash
   */
  typedef struct nodemeta {
***************
*** 53,63 ****
    uint16_t magicNumber;
    
!   /** Length of the space reserved for this node on flash */
    uint32_t reserveLength;
    
!   /** The CRC of the filename this node is associated with */
    uint16_t filenameCrc;
    
!   /** The element of the file this node represents, 0 for the first node */
    uint16_t fileElement;
  
--- 56,66 ----
    uint16_t magicNumber;
    
!   /** Length of the space reserved for this flashnode on flash */
    uint32_t reserveLength;
    
!   /** The CRC of the filename this flashnode is associated with */
    uint16_t filenameCrc;
    
!   /** The element of the file this flashnode represents, 0 for the first flashnode */
    uint16_t fileElement;
  
***************
*** 67,71 ****
  /** 
   * This is the filemeta information located directly after nodemeta
!  * information for the first node of a file on flash
   */
  typedef struct filemeta {
--- 70,74 ----
  /** 
   * This is the filemeta information located directly after nodemeta
!  * information for the first flashnode of a file on flash
   */
  typedef struct filemeta {
***************
*** 78,109 ****
  
  /** 
!  * This is the node information kept in memory for each node
   */
! typedef struct node {
!   /** The address of this node on flash */
    uint32_t flashAddress;
    
!   /** The next node in the file after this one */
!   struct node *nextNode;
    
!   /** The total length of valid data written to this node */
    uint16_t dataLength;
  
!   /** The total length of space reserved for this node */
    uint32_t reserveLength;
    
!   /** The current CRC of the node */
    uint16_t dataCrc;
  
!   /** The CRC of the filename from the file this node is associated with */
    uint16_t filenameCrc;
    
!   /** The state of the node */
    uint8_t state;
  
!   /** The index this node belongs to in its entire file */
    uint8_t fileElement;
  
! } node;
  
  
--- 81,112 ----
  
  /** 
!  * This is the flashnode information kept in memory for each node
   */
! typedef struct flashnode {
!   /** The address of this flashnode on flash */
    uint32_t flashAddress;
    
!   /** The next flashnode in the file after this one */
!   struct flashnode *nextNode;
    
!   /** The total length of valid data written to this flashnode */
    uint16_t dataLength;
  
!   /** The total length of space reserved for this flashnode */
    uint32_t reserveLength;
    
!   /** The current CRC of the flashnode */
    uint16_t dataCrc;
  
!   /** The CRC of the filename from the file this flashnode is associated with */
    uint16_t filenameCrc;
    
!   /** The state of the flashnode */
    uint8_t state;
  
!   /** The index this flashnode belongs to in its entire file */
    uint8_t fileElement;
  
! } flashnode;
  
  
***************
*** 113,118 ****
  typedef struct file {
  
!   /** The first node of this file */
!   node *firstNode;
    
    /** The calculated crc of the file, so we don't have to calculate it every time */
--- 116,121 ----
  typedef struct file {
  
!   /** The first flashnode of this file */
!   flashnode *firstNode;
    
    /** The calculated crc of the file, so we don't have to calculate it every time */
***************
*** 156,160 ****
    uint16_t filenameCrc;
    
!   /** The CRC of the data contained up to the dataLength of the node */
    uint16_t dataCrc;
  
--- 159,163 ----
    uint16_t filenameCrc;
    
!   /** The CRC of the data contained up to the dataLength of the flashnode */
    uint16_t dataCrc;
  
***************
*** 162,166 ****
    uint16_t dataLength;
    
!   /** TRUE if this node is still available for writing */
    bool writable;
    
--- 165,169 ----
    uint16_t dataLength;
    
!   /** TRUE if this flashnode is still available for writing */
    bool writable;
    
***************
*** 168,196 ****
  
  
! /** Possible node States */
  enum {
!   /** The node can be used by anything needed a node */
    NODE_EMPTY,
    
!   /** This is a special constructing node that is to be deleted if the mote is rebooted */
    NODE_CONSTRUCTING,
    
!   /** The node is valid and can be written to */
    NODE_VALID,
  
!   /** This node is valid and cannot be written to */
    NODE_LOCKED,
    
!   /** This node exists virtually, but no info has been written to flash */
    NODE_TEMPORARY,
    
!   /** This node was found on flash, but is not valid */
    NODE_DELETED,
    
!   /** This node is valid and booting */
    NODE_BOOTING,
  };
  
! /** Possible node States */
  enum {
    /** This file index is empty and can be used by anybody */
--- 171,199 ----
  
  
! /** Possible flashnode States */
  enum {
!   /** The flashnode can be used by anything */
    NODE_EMPTY,
    
!   /** This is a special constructing flashnode that is to be deleted if the mote is rebooted */
    NODE_CONSTRUCTING,
    
!   /** The flashnode is valid and can be written to */
    NODE_VALID,
  
!   /** This flashnode is valid and cannot be written to */
    NODE_LOCKED,
    
!   /** This flashnode exists virtually, but no info has been written to flash */
    NODE_TEMPORARY,
    
!   /** This flashnode was found on flash, but is not valid */
    NODE_DELETED,
    
!   /** This flashnode is valid and booting */
    NODE_BOOTING,
  };
  
! /** Possible flashnode States */
  enum {
    /** This file index is empty and can be used by anybody */
***************
*** 214,227 ****
  /** Magic Words */
  enum {
!   /** No node exists at this point in the flash */
    META_EMPTY = 0xFFFF,             // binary 1111
  
!   /** This node is being constructed. If this is found on boot, delete the node */
    META_CONSTRUCTING = 0x7777,      // binary 0111
    
!   /** This node is finalized on flash and all information is local */
    META_VALID = 0x3333,             // binary 0011
    
!   /** This node is deleted, mark up the SectorMap and move on */
    META_INVALID = 0x1111,           // binary 0001
    
--- 217,230 ----
  /** Magic Words */
  enum {
!   /** No flashnode exists at this point in the flash */
    META_EMPTY = 0xFFFF,             // binary 1111
  
!   /** This flashnode is being constructed. If this is found on boot, delete the flashnode */
    META_CONSTRUCTING = 0x7777,      // binary 0111
    
!   /** This flashnode is finalized on flash and all information is local */
    META_VALID = 0x3333,             // binary 0011
    
!   /** This flashnode is deleted, mark up the SectorMap and move on */
    META_INVALID = 0x1111,           // binary 0001
    
***************
*** 235,239 ****
  /** Global state machine for blackbook */
  enum {
!   S_IDLE = 0,
    
    /** The file system is booting */
--- 238,242 ----
  /** Global state machine for blackbook */
  enum {
!   S_BLACKBOOK_IDLE = 0,
    
    /** The file system is booting */
***************
*** 273,276 ****
--- 276,280 ----
  };
  
+ #endif
  
  

Index: BFileWriteM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/BFileWriteM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BFileWriteM.nc	7 Jun 2006 19:34:17 -0000	1.2
--- BFileWriteM.nc	28 Sep 2006 17:31:41 -0000	1.3
***************
*** 61,66 ****
    uint8_t currentClient;
    
!   /** Current node we're closing or checkpointing */
!   node *currentNode;
    
    
--- 61,66 ----
    uint8_t currentClient;
    
!   /** Current flashnode we're closing or checkpointing */
!   flashnode *currentNode;
    
    
***************
*** 119,122 ****
--- 119,128 ----
          return SUCCESS;
        }
+     
+     } else {
+       // File already open
+       call BlackbookState.toIdle();
+       signal BFileWrite.opened[currentClient](call NodeMap.getReserveLength(writers[currentClient]), SUCCESS);
+       return SUCCESS;
      }
      
***************
*** 126,129 ****
--- 132,143 ----
  
    /**
+    * @return TRUE if the given parameterized interface has a file open
+    */
+   command bool BFileWrite.isOpen[uint8_t id]() {
+     return (writers[id] != NULL);
+   }
+   
+   
+   /**
     * Close any currently opened write file.
     */
***************
*** 205,209 ****
     */
    command uint32_t BFileWrite.getRemaining[uint8_t id]() {
!     node *focusedNode;
      uint32_t remaining = 0;
      
--- 219,223 ----
     */
    command uint32_t BFileWrite.getRemaining[uint8_t id]() {
!     flashnode *focusedNode;
      uint32_t remaining = 0;
      
***************
*** 224,231 ****
     * The write open process completed
     * @param openFile - the file that was opened for writing 
!    * @param writeNode - the node to write to
     * @param result - SUCCESS if the file was correctly opened
     */
!   event void WriteAlloc.openedForWriting(file *openFile, node *writeNode, uint32_t totalSize, result_t result) {
      if(call BlackbookState.getState() == S_WRITE_BUSY) {
        if(result) {
--- 238,245 ----
     * The write open process completed
     * @param openFile - the file that was opened for writing 
!    * @param writeNode - the flashnode to write to
     * @param result - SUCCESS if the file was correctly opened
     */
!   event void WriteAlloc.openedForWriting(file *openFile, flashnode *writeNode, uint32_t totalSize, result_t result) {
      if(call BlackbookState.getState() == S_WRITE_BUSY) {
        if(result) {
***************
*** 242,246 ****
    /***************** Fileio Events ****************/
    /**
!    * Data was appended to the node in the flash.
     * @param writeBuffer - pointer to the buffer containing the data written
     * @param amountWritten - the amount of data appended to the node.
--- 256,260 ----
    /***************** Fileio Events ****************/
    /**
!    * Data was appended to the flashnode in the flash.
     * @param writeBuffer - pointer to the buffer containing the data written
     * @param amountWritten - the amount of data appended to the node.
***************
*** 272,281 ****
    /***************** Checkpoint Events ****************/
    /**
!    * The given node was updated in the Checkpoint
!    * @param focusedNode - the node that was updated
     * @param result - SUCCESS if everything's ok
     */
!   event void Checkpoint.updated(node *focusedNode, result_t result) {
!     node *previousNode;
      if(call BlackbookState.getState() == S_WRITE_SAVE_BUSY) {
        currentNode = currentNode->nextNode;
--- 286,295 ----
    /***************** Checkpoint Events ****************/
    /**
!    * The given flashnode was updated in the Checkpoint
!    * @param focusedNode - the flashnode that was updated
     * @param result - SUCCESS if everything's ok
     */
!   event void Checkpoint.updated(flashnode *focusedNode, result_t result) {
!     flashnode *previousNode;
      if(call BlackbookState.getState() == S_WRITE_SAVE_BUSY) {
        currentNode = currentNode->nextNode;
***************
*** 306,310 ****
          
          } else if(currentNode->state == NODE_VALID) {
!           // Prevent this node from ever being written to again
            currentNode->state = NODE_LOCKED;
          }
--- 320,324 ----
          
          } else if(currentNode->state == NODE_VALID) {
!           // Prevent this flashnode from ever being written to again
            currentNode->state = NODE_LOCKED;
          }
***************
*** 326,338 ****
    
    /** 
!    * A node was recovered.
     * @param result - SUCCESS if it was handled correctly.
     */
!   event void Checkpoint.recovered(node *focusedNode, result_t result) {
    }
    
    /***************** Tasks ****************/
    /**
!    * Checkpoint the open node from the current client
     */
    task void checkpointNode() {
--- 340,352 ----
    
    /** 
!    * A flashnode was recovered.
     * @param result - SUCCESS if it was handled correctly.
     */
!   event void Checkpoint.recovered(flashnode *focusedNode, result_t result) {
    }
    
    /***************** Tasks ****************/
    /**
!    * Checkpoint the open flashnode from the current client
     */
    task void checkpointNode() {

Index: SectorMapM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/SectorMapM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SectorMapM.nc	6 Jun 2006 16:50:29 -0000	1.2
--- SectorMapM.nc	28 Sep 2006 17:31:41 -0000	1.3
***************
*** 117,120 ****
--- 117,157 ----
    
    /**
+    * Obtain the largest sector that is not in use
+    * on the flash.  This will allow us to see exactly
+    * how much space exists for the next flashnode without
+    * affecting the global variable that decides which sector
+    * that may be.  This is especially useful for dictating the
+    * size of a file that is part of a continuous-write operation
+    * and the file size needs to fit exactly in one sector.
+    *
+    * @return the largest available sector that will be written to
+    *      when a SectorMap.nextLargestIdleSector() command is called
+    */
+   command flashsector *SectorMap.viewNextLargestIdleSector() {
+     int leastPages; 
+     int sectorIndex;
+     uint8_t virtualSectorIndex;
+     flashsector *largestSector = NULL;
+     
+     virtualSectorIndex = currentSectorIndex;
+     leastPages = FLASH_PAGES_PER_SECTOR;
+     
+     for(sectorIndex = FLASH_FIRST_BLACKBOOK_SECTOR; sectorIndex <= FLASH_LAST_BLACKBOOK_SECTOR; sectorIndex++) {
+       virtualSectorIndex++;
+       if(virtualSectorIndex > FLASH_LAST_BLACKBOOK_SECTOR) {
+         virtualSectorIndex = FLASH_FIRST_BLACKBOOK_SECTOR;
+       }
+       
+       if(!flashSectors[virtualSectorIndex].inUse && flashSectors[virtualSectorIndex].writePage != FLASH_PAGES_PER_SECTOR && flashSectors[virtualSectorIndex].writePage < leastPages) {
+         leastPages = flashSectors[virtualSectorIndex].writePage;
+         largestSector = &flashSectors[virtualSectorIndex];
+       }
+     }
+     
+     return largestSector;
+   }
+   
+   
+   /**
     * @return the total nodes in the given sector
     */
***************
*** 148,155 ****
    
    /**
!    * Document the existence of a node in a sector on flash.
!    * @param focusedNode - the node to document
     */
!   command void SectorMap.documentNode(node *focusedNode) {
      flashsector *mySector;
      uint32_t finalNodeAddress;
--- 185,192 ----
    
    /**
!    * Document the existence of a flashnode in a sector on flash.
!    * @param focusedNode - the flashnode to document
     */
!   command void SectorMap.documentNode(flashnode *focusedNode) {
      flashsector *mySector;
      uint32_t finalNodeAddress;
***************
*** 158,162 ****
  
      if(call SectorMap.getSectorWriteAddress(mySector) <= focusedNode->flashAddress) {      
!       // Note the address check above - if this node was already registered,
        // then totalUnfinalizedNodes can't be incremented twice.
        // Unfinalized 
--- 195,199 ----
  
      if(call SectorMap.getSectorWriteAddress(mySector) <= focusedNode->flashAddress) {      
!       // Note the address check above - if this flashnode was already registered,
        // then totalUnfinalizedNodes can't be incremented twice.
        // Unfinalized 
***************
*** 179,186 ****
    
    /**
!    * Remove a valid node from its sector. 
     * This helps the garbage collector know which sectors to erase.
     */
!   command void SectorMap.removeNode(node *focusedNode) { 
      if(call SectorMap.getSectorWriteAddress(call SectorMap.getSectorAtAddress(focusedNode->flashAddress)) > focusedNode->flashAddress) {      
        (call SectorMap.getSectorAtAddress(focusedNode->flashAddress))->totalNodes--;
--- 216,223 ----
    
    /**
!    * Remove a valid flashnode from its sector. 
     * This helps the garbage collector know which sectors to erase.
     */
!   command void SectorMap.removeNode(flashnode *focusedNode) { 
      if(call SectorMap.getSectorWriteAddress(call SectorMap.getSectorAtAddress(focusedNode->flashAddress)) > focusedNode->flashAddress) {      
        (call SectorMap.getSectorAtAddress(focusedNode->flashAddress))->totalNodes--;
***************
*** 189,195 ****
    
    /**
!    * @return TRUE if the given node is within the bounds of the given sector
     */
!   command bool SectorMap.isInSector(flashsector *focusedSector, node *focusedNode) {
      return (call SectorMap.getSectorBaseAddress(focusedSector) <= focusedNode->flashAddress)
          && focusedNode->flashAddress < (call SectorMap.getSectorBaseAddress(focusedSector) + FLASH_SECTOR_LENGTH);
--- 226,232 ----
    
    /**
!    * @return TRUE if the given flashnode is within the bounds of the given sector
     */
!   command bool SectorMap.isInSector(flashsector *focusedSector, flashnode *focusedNode) {
      return (call SectorMap.getSectorBaseAddress(focusedSector) <= focusedNode->flashAddress)
          && focusedNode->flashAddress < (call SectorMap.getSectorBaseAddress(focusedSector) + FLASH_SECTOR_LENGTH);

Index: BFileDirM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/BFileDirM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** BFileDirM.nc	18 May 2006 22:34:20 -0000	1.1
--- BFileDirM.nc	28 Sep 2006 17:31:42 -0000	1.2
***************
*** 51,56 ****
  implementation {
  
!   /** The current node to verify the CRC for */
!   node *crcNode;
    
    /** The current file to verify the CRC for */
--- 51,56 ----
  implementation {
  
!   /** The current flashnode to verify the CRC for */
!   flashnode *crcNode;
    
    /** The current file to verify the CRC for */
***************
*** 219,223 ****
     * Find if a file is corrupt. This will read each node
     * from the file and verify it against its dataCrc.
!    * If the calculated data CRC from a node does
     * not match the node's recorded CRC, the file is corrupt.
     * @return SUCCESS if the corrupt check will proceed.
--- 219,223 ----
     * Find if a file is corrupt. This will read each node
     * from the file and verify it against its dataCrc.
!    * If the calculated data CRC from a flashnode does
     * not match the node's recorded CRC, the file is corrupt.
     * @return SUCCESS if the corrupt check will proceed.
***************
*** 319,327 ****
    }
  
    
    /***************** NodeShop Events ****************/ 
    /**
!    * A crc was calculated from node data on flash
!    * @param dataCrc - the crc of the data read from the node on flash.
     * @param result - SUCCESS if the crc is valid
     */
--- 319,330 ----
    }
  
+   event void BDictionary.totalKeys(uint16_t totalKeys) {
+   }
+   
    
    /***************** NodeShop Events ****************/ 
    /**
!    * A crc was calculated from flashnode data on flash
!    * @param dataCrc - the crc of the data read from the flashnode on flash.
     * @param result - SUCCESS if the crc is valid
     */
***************
*** 339,343 ****
           
      } else {
!       // This node is corrupted, so the whole file is corrupt.
        call BlackbookState.toIdle();
        signal BFileDir.corruptionCheckDone[currentClient]((char *) (&filenameBuffer), TRUE, SUCCESS);
--- 342,346 ----
           
      } else {
!       // This flashnode is corrupted, so the whole file is corrupt.
        call BlackbookState.toIdle();
        signal BFileDir.corruptionCheckDone[currentClient]((char *) (&filenameBuffer), TRUE, SUCCESS);
***************
*** 358,374 ****
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the node that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(node *focusedNode, result_t result) {
    }
    
    /**
!    * A node was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the node that was deleted.
!    * @param result - SUCCESS if the node was deleted successfully.
     */
!   event void NodeShop.metaDeleted(node *focusedNode, result_t result) {
    }
    
--- 361,377 ----
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the flashnode that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(flashnode *focusedNode, result_t result) {
    }
    
    /**
!    * A flashnode was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the flashnode that was deleted.
!    * @param result - SUCCESS if the flashnode was deleted successfully.
     */
!   event void NodeShop.metaDeleted(flashnode *focusedNode, result_t result) {
    }
    

Index: NodeMapM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/NodeMapM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NodeMapM.nc	6 Jun 2006 16:50:29 -0000	1.2
--- NodeMapM.nc	28 Sep 2006 17:31:42 -0000	1.3
***************
*** 53,57 ****
    
    /** The array of nodes in memory */
!   node nodes[MAX_FILES*NODES_PER_FILE];
    
    
--- 53,57 ----
    
    /** The array of nodes in memory */
!   flashnode nodes[MAX_FILES*NODES_PER_FILE];
    
    
***************
*** 86,90 ****
    /***************** NodeBooter Commands *****************/
    /**
!    * Request to add a node to the file system.
     * It is the responsibility of the calling function
     * to properly setup:
--- 86,90 ----
    /***************** NodeBooter Commands *****************/
    /**
!    * Request to add a flashnode to the file system.
     * It is the responsibility of the calling function
     * to properly setup:
***************
*** 97,104 ****
     * 
     * Unless manually linked, state and nextNode are handled by NodeMap.
!    * @return a pointer to an empty node if one is available
     *     NULL if no more exist
     */
!   command node *NodeBooter.requestAddNode() {
      int i;
  
--- 97,104 ----
     * 
     * Unless manually linked, state and nextNode are handled by NodeMap.
!    * @return a pointer to an empty flashnode if one is available
     *     NULL if no more exist
     */
!   command flashnode *NodeBooter.requestAddNode() {
      int i;
  
***************
*** 145,149 ****
      int fileIndex;
      int nodeIndex;
!     node *lastLinkedNode;
      uint8_t currentElement;
      
--- 145,149 ----
      int fileIndex;
      int nodeIndex;
!     flashnode *lastLinkedNode;
      uint8_t currentElement;
      
***************
*** 159,172 ****
            // Check out the next node
            if(nodes[nodeIndex].state != NODE_EMPTY) {
!             // This node needs to be linked
              if(nodes[nodeIndex].filenameCrc == files[fileIndex].filenameCrc) {
                // and it belongs to the current file we're linking
                if(nodes[nodeIndex].fileElement == currentElement) {
!                 // in fact it's the next node we're looking for
                  if(currentElement == 0) {
!                   // This is the first node of the file
                    files[fileIndex].firstNode = &nodes[nodeIndex];
                  } else {
!                   // This is the next node of the file
                    lastLinkedNode->nextNode = &nodes[nodeIndex];
                  }
--- 159,172 ----
            // Check out the next node
            if(nodes[nodeIndex].state != NODE_EMPTY) {
!             // This flashnode needs to be linked
              if(nodes[nodeIndex].filenameCrc == files[fileIndex].filenameCrc) {
                // and it belongs to the current file we're linking
                if(nodes[nodeIndex].fileElement == currentElement) {
!                 // in fact it's the next flashnode we're looking for
                  if(currentElement == 0) {
!                   // This is the first flashnode of the file
                    files[fileIndex].firstNode = &nodes[nodeIndex];
                  } else {
!                   // This is the next flashnode of the file
                    lastLinkedNode->nextNode = &nodes[nodeIndex];
                  }
***************
*** 186,191 ****
      // Remove all the dangling nodes - although this should never happen,
      // we take some precautions.  One issue is this will not erase
!     // the node's checkpoint, so the checkpoint for this node will 
!     // be around forever, until another node is written to its location
      // I'd rather have a lingering 18 byte checkpoint hanging around
      // than a sector-long undeletable node
--- 186,191 ----
      // Remove all the dangling nodes - although this should never happen,
      // we take some precautions.  One issue is this will not erase
!     // the node's checkpoint, so the checkpoint for this flashnode will 
!     // be around forever, until another flashnode is written to its location
      // I'd rather have a lingering 18 byte checkpoint hanging around
      // than a sector-long undeletable node
***************
*** 234,246 ****
    
    /**
!    * Get the node and offset into the node that represents
     * an address in a file
     * @param focusedFile - the file to find the address in
     * @param fileAddress - the address to find
     * @param returnOffset - pointer to a location to store the offset into the node
!    * @return the node that contains the file address in the file.
     */
!   command node *NodeMap.getAddressInFile(file *focusedFile, uint32_t fileAddress, uint16_t *returnOffset) {
!     node *focusedNode;
      uint16_t nodeLength;
      uint32_t currentAddress = 0;
--- 234,246 ----
    
    /**
!    * Get the flashnode and offset into the flashnode that represents
     * an address in a file
     * @param focusedFile - the file to find the address in
     * @param fileAddress - the address to find
     * @param returnOffset - pointer to a location to store the offset into the node
!    * @return the flashnode that contains the file address in the file.
     */
!   command flashnode *NodeMap.getAddressInFile(file *focusedFile, uint32_t fileAddress, uint16_t *returnOffset) {
!     flashnode *focusedNode;
      uint16_t nodeLength;
      uint32_t currentAddress = 0;
***************
*** 271,275 ****
     */
    command uint8_t NodeMap.getTotalNodesInFile(file *focusedFile) {
!     node *currentNode;
      uint8_t totalNodes = 0;
     
--- 271,275 ----
     */
    command uint8_t NodeMap.getTotalNodesInFile(file *focusedFile) {
!     flashnode *currentNode;
      uint8_t totalNodes = 0;
     
***************
*** 301,305 ****
     * @return the node's position in a file, 0xFF if not valid
     *
!   command uint8_t NodeMap.getElementNumber(node *focusedNode) {
      file *parentFile;
      
--- 301,305 ----
     * @return the node's position in a file, 0xFF if not valid
     *
!   command uint8_t NodeMap.getElementNumber(flashnode *focusedNode) {
      file *parentFile;
      
***************
*** 316,321 ****
     * @return the node's position in the given file, 0xFF if not valid
     *
!   command uint8_t NodeMap.getElementNumberFromFile(node *focusedNode, file *focusedFile) {
!     node *currentNode;
      uint8_t elementNumber = 0;
      
--- 316,321 ----
     * @return the node's position in the given file, 0xFF if not valid
     *
!   command uint8_t NodeMap.getElementNumberFromFile(flashnode *focusedNode, file *focusedFile) {
!     flashnode *currentNode;
      uint8_t elementNumber = 0;
      
***************
*** 353,357 ****
     * @return the file associated with the given node, NULL if n/a.
     */
!   command file *NodeMap.getFileFromNode(node *focusedNode) {
      int i;
      if(focusedNode == NULL || focusedNode->state == NODE_EMPTY) {
--- 353,357 ----
     * @return the file associated with the given node, NULL if n/a.
     */
!   command file *NodeMap.getFileFromNode(flashnode *focusedNode) {
      int i;
      if(focusedNode == NULL || focusedNode->state == NODE_EMPTY) {
***************
*** 384,391 ****
    
    /**
!    * Get a node at a given index
!    * @return the node if it exists, NULL if it doesn't.
     */
!   command node *NodeMap.getNodeAtIndex(uint8_t nodeIndex) {
      if(nodeIndex < call NodeMap.getMaxNodes()) {
        return &nodes[nodeIndex];
--- 384,391 ----
    
    /**
!    * Get a flashnode at a given index
!    * @return the flashnode if it exists, NULL if it doesn't.
     */
!   command flashnode *NodeMap.getNodeAtIndex(uint8_t nodeIndex) {
      if(nodeIndex < call NodeMap.getMaxNodes()) {
        return &nodes[nodeIndex];
***************
*** 399,403 ****
     */
    command uint32_t NodeMap.getDataLength(file *focusedFile) {
!     node *focusedNode;
      uint32_t dataLength = 0;
      
--- 399,403 ----
     */
    command uint32_t NodeMap.getDataLength(file *focusedFile) {
!     flashnode *focusedNode;
      uint32_t dataLength = 0;
      
***************
*** 413,417 ****
     */
    command uint32_t NodeMap.getReserveLength(file *focusedFile) {
!     node *focusedNode;
      uint32_t reserveLength = 0;
      
--- 413,417 ----
     */
    command uint32_t NodeMap.getReserveLength(file *focusedFile) {
!     flashnode *focusedNode;
      uint32_t reserveLength = 0;
      
***************
*** 428,432 ****
     *     number.
     */
!   command bool NodeMap.hasDuplicate(node *focusedNode) {
      int i;
      uint8_t numNodes = 0;
--- 428,432 ----
     *     number.
     */
!   command bool NodeMap.hasDuplicate(flashnode *focusedNode) {
      int i;
      uint8_t numNodes = 0;

Index: BFileDeleteM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/BFileDeleteM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BFileDeleteM.nc	6 Jun 2006 16:50:29 -0000	1.2
--- BFileDeleteM.nc	28 Sep 2006 17:31:43 -0000	1.3
***************
*** 55,66 ****
    file *currentFile;
    
!   /** The current node we're focused on */
!   node *currentNode;
    
!   /** The node previous to the current node we're focused on */
!   node *previousNode;
    
    /***************** Prototypes ****************/
!   /** Finalize the current node if it needs to be */
    task void finalize();
    
--- 55,66 ----
    file *currentFile;
    
!   /** The current flashnode we're focused on */
!   flashnode *currentNode;
    
!   /** The flashnode previous to the current flashnode we're focused on */
!   flashnode *previousNode;
    
    /***************** Prototypes ****************/
!   /** Finalize the current flashnode if it needs to be */
    task void finalize();
    
***************
*** 68,75 ****
    /***************** BFileDelete Commands ****************/
    /**
!    * Delete a file - from the last node to the first node,
     * to prevent the creation of dangling nodes.
     *
!    *  1. Locate the last existing node of the file.
     *  2. Delete it, remove its checkpoint.
     *  3. Repeat steps 1 and 2 until all nodes are invalidated.
--- 68,75 ----
    /***************** BFileDelete Commands ****************/
    /**
!    * Delete a file - from the last flashnode to the first node,
     * to prevent the creation of dangling nodes.
     *
!    *  1. Locate the last existing flashnode of the file.
     *  2. Delete it, remove its checkpoint.
     *  3. Repeat steps 1 and 2 until all nodes are invalidated.
***************
*** 101,110 ****
    /***************** NodeShop ****************/
    /**
!    * A node was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the node that was deleted.
!    * @param result - SUCCESS if the node was deleted successfully.
     */
!   event void NodeShop.metaDeleted(node *focusedNode, result_t result) {
      if(call BlackbookState.getState() == S_DELETE_BUSY) {
        currentNode->state = NODE_EMPTY;
--- 101,110 ----
    /***************** NodeShop ****************/
    /**
!    * A flashnode was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the flashnode that was deleted.
!    * @param result - SUCCESS if the flashnode was deleted successfully.
     */
!   event void NodeShop.metaDeleted(flashnode *focusedNode, result_t result) {
      if(call BlackbookState.getState() == S_DELETE_BUSY) {
        currentNode->state = NODE_EMPTY;
***************
*** 126,131 ****
   
    /**
!    * A crc was calculated from node data on flash
!    * @param dataCrc - the crc of the data read from the node on flash.
     * @param result - SUCCESS if the crc is valid
     */
--- 126,131 ----
   
    /**
!    * A crc was calculated from flashnode data on flash
!    * @param dataCrc - the crc of the data read from the flashnode on flash.
     * @param result - SUCCESS if the crc is valid
     */
***************
*** 135,142 ****
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the node that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(node *focusedNode, result_t result) {
    }
    
--- 135,142 ----
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the flashnode that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(flashnode *focusedNode, result_t result) {
    }
    
***************
*** 154,162 ****
    /***************** Checkpoint Events *****************/
    /**
!    * The given node was updated in the Checkpoint
!    * @param focusedNode - the node that was updated
     * @param result - SUCCESS if everything's ok
     */
!   event void Checkpoint.updated(node *focusedNode, result_t result) {
      if(call BlackbookState.getState() == S_DELETE_BUSY) {
        call NodeShop.deleteNode(currentNode);
--- 154,162 ----
    /***************** Checkpoint Events *****************/
    /**
!    * The given flashnode was updated in the Checkpoint
!    * @param focusedNode - the flashnode that was updated
     * @param result - SUCCESS if everything's ok
     */
!   event void Checkpoint.updated(flashnode *focusedNode, result_t result) {
      if(call BlackbookState.getState() == S_DELETE_BUSY) {
        call NodeShop.deleteNode(currentNode);
***************
*** 172,179 ****
    
    /** 
!    * A node was recovered.
     * @param result - SUCCESS if it was handled correctly.
     */
!   event void Checkpoint.recovered(node *focusedNode, result_t result) { 
    }
    
--- 172,179 ----
    
    /** 
!    * A flashnode was recovered.
     * @param result - SUCCESS if it was handled correctly.
     */
!   event void Checkpoint.recovered(flashnode *focusedNode, result_t result) { 
    }
    
***************
*** 185,191 ****
    task void finalize() {
      if((currentNode->nextNode == NULL) || currentNode->nextNode->state == NODE_DELETED) {
!       // Working from the last node in the file to the first node:
        // 1. Remove the checkpoint. This way, if we reboot in the middle,
!       //    the node will get erased anyway.
        // 2. Invalidate the nodemeta through NodeShop.
        
--- 185,191 ----
    task void finalize() {
      if((currentNode->nextNode == NULL) || currentNode->nextNode->state == NODE_DELETED) {
!       // Working from the last flashnode in the file to the first node:
        // 1. Remove the checkpoint. This way, if we reboot in the middle,
!       //    the flashnode will get erased anyway.
        // 2. Invalidate the nodemeta through NodeShop.
        
***************
*** 194,198 ****
        
      } else {
!       // Run to the last node of the file
        previousNode = currentNode;
        currentNode = currentNode->nextNode;
--- 194,198 ----
        
      } else {
!       // Run to the last flashnode of the file
        previousNode = currentNode;
        currentNode = currentNode->nextNode;

Index: CheckpointDummyM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/CheckpointDummyM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CheckpointDummyM.nc	18 May 2006 22:34:20 -0000	1.1
--- CheckpointDummyM.nc	28 Sep 2006 17:31:44 -0000	1.2
***************
*** 48,57 ****
    }
    
!   command result_t Checkpoint.update(node *focusedNode) {
      signal Checkpoint.updated(focusedNode, SUCCESS);
      return SUCCESS;
    }
    
!   command result_t Checkpoint.recover(node *focusedNode) {
      signal Checkpoint.recovered(focusedNode, SUCCESS);
      return SUCCESS;
--- 48,57 ----
    }
    
!   command result_t Checkpoint.update(flashnode *focusedNode) {
      signal Checkpoint.updated(focusedNode, SUCCESS);
      return SUCCESS;
    }
    
!   command result_t Checkpoint.recover(flashnode *focusedNode) {
      signal Checkpoint.recovered(focusedNode, SUCCESS);
      return SUCCESS;

Index: FileioM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/core/FileioM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FileioM.nc	6 Jun 2006 16:50:29 -0000	1.2
--- FileioM.nc	28 Sep 2006 17:31:44 -0000	1.3
***************
*** 55,63 ****
  implementation {
  
!   /** Offset to read/write in the node */
    uint16_t offset;
    
!   /** The node to interact with */
!   node *currentNode;
    
    /** The current file we're interacting with */
--- 55,63 ----
  implementation {
  
!   /** Offset to read/write in the flashnode */
    uint16_t offset;
    
!   /** The flashnode to interact with */
!   flashnode *currentNode;
    
    /** The current file we're interacting with */
***************
*** 100,104 ****
    /***************** Fileio Commands ****************/
    /**
!    * Write data to the node belonging to the given file
     * at the given address in the file
     * @param currentFile - the file to write to
--- 100,104 ----
    /***************** Fileio Commands ****************/
    /**
!    * Write data to the flashnode belonging to the given file
     * at the given address in the file
     * @param currentFile - the file to write to
***************
*** 120,124 ****
    
    /**
!    * Read data from the node belonging to the given file
     * at the given address in the file
     * @param currentFile - the file to read from
--- 120,124 ----
    
    /**
!    * Read data from the flashnode belonging to the given file
     * at the given address in the file
     * @param currentFile - the file to read from
***************
*** 219,226 ****
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the node that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(node *focusedNode, result_t result) {
      if(isWriting()) {
        post transaction();
--- 219,226 ----
    /** 
     * The node's metadata was written to flash
!    * @param focusedNode - the flashnode that metadata was written for
     * @param result - SUCCESS if it was written
     */
!   event void NodeShop.metaWritten(flashnode *focusedNode, result_t result) {
      if(isWriting()) {
        post transaction();
***************
*** 238,252 ****
    
    /**
!    * A node was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the node that was deleted.
!    * @param result - SUCCESS if the node was deleted successfully.
     */
!   event void NodeShop.metaDeleted(node *focusedNode, result_t result) {
    }
   
    /**
!    * A crc was calculated from node data on flash
!    * @param dataCrc - the crc of the data read from the node on flash.
     * @param result - SUCCESS if the crc is valid
     */
--- 238,252 ----
    
    /**
!    * A flashnode was deleted from flash by marking its magic number
     * invalid in the metadata.
!    * @param focusedNode - the flashnode that was deleted.
!    * @param result - SUCCESS if the flashnode was deleted successfully.
     */
!   event void NodeShop.metaDeleted(flashnode *focusedNode, result_t result) {
    }
   
    /**
!    * A crc was calculated from flashnode data on flash
!    * @param dataCrc - the crc of the data read from the flashnode on flash.
     * @param result - SUCCESS if the crc is valid
     */
***************
*** 323,343 ****
    
    /**
!    * After one node is completely written,
!    * the node must be finalized to the Checkpoint
!    * and the next node metadata must be written
     * and obtained before proceeding.
!    * Check that the next node exists before entering
     * this function
     */
    task void writeNextNode() {
      bool constructing = currentNode->state == NODE_CONSTRUCTING;
!     // 1. Lock this node in RAM
!     // 2. Make the current node the next node... then,
      // 3. Write the current node's metadata in NodeShop
      // 4. Continue transaction.
      
      
!     // A node that is constructing virtually gets a special
!     // magic number that will delete the node if the 
      // mote reboots before we're completely done with the
      // update.
--- 323,343 ----
    
    /**
!    * After one flashnode is completely written,
!    * the flashnode must be finalized to the Checkpoint
!    * and the next flashnode metadata must be written
     * and obtained before proceeding.
!    * Check that the next flashnode exists before entering
     * this function
     */
    task void writeNextNode() {
      bool constructing = currentNode->state == NODE_CONSTRUCTING;
!     // 1. Lock this flashnode in RAM
!     // 2. Make the current flashnode the next node... then,
      // 3. Write the current node's metadata in NodeShop
      // 4. Continue transaction.
      
      
!     // A flashnode that is constructing virtually gets a special
!     // magic number that will delete the flashnode if the 
      // mote reboots before we're completely done with the
      // update.
***************
*** 389,393 ****
      // Any information written to the end of a file must be appended!
      // Because if the next address to write to actually belongs to
!     // the next node in the file, that node is checked to see if its
      // metadata is actually written to flash.  This won't check
      // to see if any previous nodes before it have their metadatas
--- 389,393 ----
      // Any information written to the end of a file must be appended!
      // Because if the next address to write to actually belongs to
!     // the next flashnode in the file, that flashnode is checked to see if its
      // metadata is actually written to flash.  This won't check
      // to see if any previous nodes before it have their metadatas



More information about the Tinyos-contrib-commits mailing list