[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/at45db At45dbStorageManagerC.nc, 1.2, 1.3 LogStorageP.nc, 1.8, 1.9

David Gay idgay at users.sourceforge.net
Mon Jun 23 14:11:11 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29960

Modified Files:
	At45dbStorageManagerC.nc LogStorageP.nc 
Log Message:
add @safe(), deputize LogStorageP, fix LogStorageP bug

Index: At45dbStorageManagerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/At45dbStorageManagerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** At45dbStorageManagerC.nc	12 Jul 2006 17:01:01 -0000	1.2
--- At45dbStorageManagerC.nc	23 Jun 2008 21:11:09 -0000	1.3
***************
*** 15,19 ****
   */
  
! module At45dbStorageManagerC {
    provides interface At45dbVolume[volume_id_t volid];
  }
--- 15,19 ----
   */
  
! module At45dbStorageManagerC @safe() {
    provides interface At45dbVolume[volume_id_t volid];
  }

Index: LogStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/LogStorageP.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** LogStorageP.nc	23 Jun 2008 20:25:15 -0000	1.8
--- LogStorageP.nc	23 Jun 2008 21:11:09 -0000	1.9
***************
*** 201,205 ****
    bool recordsLost;
    at45page_t firstPage, lastPage;
!   storage_len_t len;
    nx_struct pageinfo metadata;
  
--- 201,205 ----
    bool recordsLost;
    at45page_t firstPage, lastPage;
!   storage_len_t pos;
    nx_struct pageinfo metadata;
  
***************
*** 207,211 ****
      /* The latest request made for this client, and it's arguments */
      uint8_t request; 
!     uint8_t *buf;
      storage_len_t len;
  
--- 207,211 ----
      /* The latest request made for this client, and it's arguments */
      uint8_t request; 
!     uint8_t *COUNT_NOK(len) buf;
      storage_len_t len;
  
***************
*** 307,312 ****
      uint8_t c = client;
      uint8_t request = s[c].request;
!     storage_len_t actualLen = s[c].len - len;
!     void *ptr = s[c].buf - actualLen;
      
      client = NO_CLIENT;
--- 307,312 ----
      uint8_t c = client;
      uint8_t request = s[c].request;
!     storage_len_t actualLen = pos;
!     void *ptr = s[c].buf;
      
      client = NO_CLIENT;
***************
*** 327,331 ****
    /* Enqueue request and request the underlying flash */
    error_t newRequest(uint8_t newRequest, uint8_t id,
! 		     uint8_t *buf, storage_len_t length) {
      s[id >> 1].circular = id & 1;
      id >>= 1;
--- 327,331 ----
    /* Enqueue request and request the underlying flash */
    error_t newRequest(uint8_t newRequest, uint8_t id,
! 		     uint8_t *COUNT_NOK(length) buf, storage_len_t length) {
      s[id >> 1].circular = id & 1;
      id >>= 1;
***************
*** 335,340 ****
  
      s[id].request = newRequest;
!     s[id].buf = buf;
      s[id].len = length;
      call Resource.request[id]();
  
--- 335,341 ----
  
      s[id].request = newRequest;
!     s[id].buf = NULL;
      s[id].len = length;
+     s[id].buf = buf;
      call Resource.request[id]();
  
***************
*** 344,353 ****
    event void Resource.granted[uint8_t id]() {
      client = id;
!     len = s[client].len;
      startRequest();
    }
  
    command error_t LogWrite.append[uint8_t id](void* buf, storage_len_t length) {
!     if (len > call LogRead.getSize[id]() - PAGE_SIZE)
        /* Writes greater than the volume size are invalid.
  	 Writes equal to the volume size could break the log volume
--- 345,354 ----
    event void Resource.granted[uint8_t id]() {
      client = id;
!     pos = 0;
      startRequest();
    }
  
    command error_t LogWrite.append[uint8_t id](void* buf, storage_len_t length) {
!     if (length > call LogRead.getSize[id]() - PAGE_SIZE)
        /* Writes greater than the volume size are invalid.
  	 Writes equal to the volume size could break the log volume
***************
*** 383,387 ****
  
    command error_t LogRead.seek[uint8_t id](storage_cookie_t offset) {
!     return newRequest(R_SEEK, id, (void *)((uint16_t)(offset >> 16)), offset);
    }
  
--- 384,388 ----
  
    command error_t LogRead.seek[uint8_t id](storage_cookie_t offset) {
!     return newRequest(R_SEEK, id, TCAST(void *COUNT(offset), ((uint16_t)(offset >> 16))), offset);
    }
  
***************
*** 572,577 ****
  
    void appendContinue() {
!     uint8_t *buf = s[client].buf;
      at45pageoffset_t offset = s[client].woffset, count;
      
      if (len == 0)
--- 573,579 ----
  
    void appendContinue() {
!     uint8_t *buf = s[client].buf + pos;
      at45pageoffset_t offset = s[client].woffset, count;
+     storage_len_t len = s[client].len - pos;
      
      if (len == 0)
***************
*** 593,600 ****
        count = PAGE_SIZE - offset;
  
-     s[client].buf += count;
      s[client].wpos += count;
      s[client].woffset += count;
!     len -= count;
  
      /* We normally lose data at the point we make the first write to a
--- 595,601 ----
        count = PAGE_SIZE - offset;
  
      s[client].wpos += count;
      s[client].woffset += count;
!     pos += count;
  
      /* We normally lose data at the point we make the first write to a
***************
*** 625,628 ****
--- 626,630 ----
  
    void appendStart() {
+     storage_len_t len = s[client].len - pos;
      storage_len_t vlen = (storage_len_t)npages() * PAGE_SIZE;
  
***************
*** 721,727 ****
  
    void readContinue() {
!     uint8_t *buf = s[client].buf;
      at45pageoffset_t offset = s[client].roffset, count;
      at45pageoffset_t end = s[client].rend;
      
      if (len == 0)
--- 723,730 ----
  
    void readContinue() {
!     uint8_t *buf = s[client].buf + pos;
      at45pageoffset_t offset = s[client].roffset, count;
      at45pageoffset_t end = s[client].rend;
+     storage_len_t len = s[client].len - pos;
      
      if (len == 0)
***************
*** 765,770 ****
        count = end - offset;
  
!     s[client].buf += count;
!     len -= count;
      s[client].rpos += count;
      s[client].roffset = offset + count;
--- 768,772 ----
        count = end - offset;
  
!     pos += count;
      s[client].rpos += count;
      s[client].roffset = offset + count;



More information about the Tinyos-2-commits mailing list