Yup - just like I explained in that last email, by default Blackbook offers
19 MAX_FILES (BlackbookConst.h).  One of those files is taken up by the
checkpoint file (bb.cp_).  So that leaves you with 18 files.  Without
deleting some files, you'll be stuck.

 

If you want to increase the number of files the file system can hold,
increase the MAX_FILES definition.

 

-David

 

 

  _____  

From: Mayur Maheshwari [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 06, 2007 6:59 AM
To: David Moss; tinyos-help@millennium.berkeley.edu
Subject: Write Fails in BlackBook Files System

 

 

Hi David

 

It seems that write fails after 18 files have been written. (I am trying to
write a new file every 3 seconds). Any idea why this should happen? 

 

I am using telosb with tinyos 2.0.1

 

The write app which I am using is as follows:

 

module WriteCheckC {
  uses interface BBoot;
  uses interface BFileWrite;
  uses interface Boot;
  uses interface Leds;
  uses interface Timer<TMilli> as Timer0;
}

implementation {

 uint32_t fileNumber;

 char *reverseString(char temp[10])
{
 int k=0;
 int len = strlen(temp);

 while(k<(len+1)/2)
 {
  char t = temp[k];
  temp[k] = temp[len-k-1];
  temp[len-k-1] = t;
  k++;
 }
 temp[len] = '\0'; 
 return temp;
} 

char *getString(int i)
{
 int j=i;
 int k=0;
 char temp[10];

 while(j)
 {
  temp[k] = j%10 + 48;
  j /= 10;
  k++;
 }
 temp[k] = '\0';

 return reverseString(temp);
}

 event void Boot.booted() {}

 event void BBoot.booted(uint16_t totalNodes, uint8_t totalFiles, error_t
error) {
  call Timer0.startPeriodic(3000);
 }

  event void Timer0.fired() {

 char *temp;
 char file1[20];
 temp = getString(fileNumber);
 strcpy(file1, "b");
 strcat(file1, temp);
 call BFileWrite.open(file1, sizeof(uint32_t));
  }

  event void BFileWrite.opened(uint32_t len, error_t error) 
  {
      uint16_t sense = 12;
   call Leds.led0Toggle();

   call BFileWrite.append(&sense, sizeof(sense));
  }

  event void BFileWrite.appended(void *data, uint16_t amountWritten, error_t
error) 
  {
   call BFileWrite.save();
  }

  event void BFileWrite.saved(error_t error) {
   call BFileWrite.close();
  }

  event void BFileWrite.closed(error_t error) {fileNumber++; 
  call Leds.led2Toggle();}

}

 

 

Thanks,

Mayur



-- 
Mayur Maheshwari([EMAIL PROTECTED])

"Karmanye Vadhikaraste Ma Phaleshu Kadachana, 
Ma Karma Phala Hetur Bhurmatey Sangostva Akarmani" 

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to