#include <stdio.h>
#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+unsigned yaffs_traceMask = 0xFFFFFFFF;
+
yaffs_Device device;
x = yaffs_RenameObject(yaffs_Root(dev),"Name1",NULL,"Rename");
- for(i = 0; i < 100000; i+=64)
+// Write a file with overwrite, then read it back and save outside yaffs
+// This is to test that write caching works.
+
+ for(i = 0; i < 100; i++)
{
+ unsigned char x[500];
- b++;
- if(b & 1)
- written = yaffs_WriteDataToFile(f,testStr,i,64);
- else
- written = yaffs_WriteDataToFile(f,testStr2,i,64);
+ memset(x,i,500);
+
+ written = yaffs_WriteDataToFile(f,x,i*500,500);
+ }
+
+ for(i = 0; i < 100; i++)
+ {
+ unsigned char x;
+
+ x = i+5;
+
+ written = yaffs_WriteDataToFile(f,&x,i*500 + 2,1);
+ }
+
+
+ {
+ int h;
+
+ h = open("bork",O_RDWR | O_CREAT | O_TRUNC,0666);
+ for(i = 0; i < 100; i++)
+ {
+ unsigned char x[500];
+
+ yaffs_ReadDataFromFile(f,x,i*500,500);
+ write(h,x,500);
+ }
+ close(h);
- written = yaffs_WriteDataToFile(f,testStr2,1,20);
}
+
+// Big write to fill disk
+
+ written = 1;
+ for(i = 0; i < 1000000 && written > 0; i++)
+ {
+ unsigned char x[500];
+
+ memset(x,i,500);
+
+ written = yaffs_WriteDataToFile(f,x,i*500,500);
+ }
+ if(written <= 0)
+ {
+ printf("YAFFS full\n");
+ }
+
// some short reads
for(i = 1000; i < 50000; i+=2)
{