X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs%2F.git;a=blobdiff_plain;f=direct%2Fdtest.c;fp=direct%2Fdtest.c;h=921b066d2c1c15f24451ba1c49a5b65c84996f8d;hp=9051c234fbb4c2820ef8380c6dfdacc875ef53d9;hb=ce5e10874d3f7ef75757bb48bbf7181d63f2ef2c;hpb=24e04c35b63138c14224754f9636e6b2a6915f3b diff --git a/direct/dtest.c b/direct/dtest.c index 9051c23..921b066 100644 --- a/direct/dtest.c +++ b/direct/dtest.c @@ -198,8 +198,8 @@ void dumpDirFollow(const char *dname) yaffs_stat(str,&s); - printf("%s length %d mode %X ",de->d_name,s.st_size,s.st_mode); - switch(s.st_mode & S_IFMT) + printf("%s length %d mode %X ",de->d_name,s.yst_size,s.yst_mode); + switch(s.yst_mode & S_IFMT) { case S_IFREG: printf("data file"); break; case S_IFDIR: printf("directory"); break; @@ -243,8 +243,8 @@ void dumpDir(const char *dname) yaffs_lstat(str,&s); - printf("%s length %d mode %X ",de->d_name,s.st_size,s.st_mode); - switch(s.st_mode & S_IFMT) + printf("%s length %d mode %X ",de->d_name,s.yst_size,s.yst_mode); + switch(s.yst_mode & S_IFMT) { case S_IFREG: printf("data file"); break; case S_IFDIR: printf("directory"); break; @@ -478,7 +478,7 @@ int long_test(int argc, char *argv[]) // Check chmod yaffs_stat("/boot/yyfile",&ystat); - temp_mode = ystat.st_mode; + temp_mode = ystat.yst_mode; yaffs_chmod("/boot/yyfile",0x55555); printf("\nDirectory look-up of /boot\n"); @@ -675,6 +675,33 @@ int free_space_check(void) } +int BeatsTest(void) +{ + int h; + char b[2000]; + int freeSpace; + int fsize; + yaffs_StartUp(); + yaffs_mount("/ram"); + + h = yaffs_open("/ram/f1", O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); + + freeSpace = yaffs_freespace("/ram"); + printf("start free space %d\n",freeSpace); + + while(yaffs_write(h,b,600) > 0) { + fsize = yaffs_lseek(h,0,SEEK_CUR); + freeSpace = yaffs_freespace("/ram"); + printf(" %d = %d + %d\n",fsize + freeSpace,fsize,freeSpace); + } + yaffs_close(h); + + freeSpace = yaffs_freespace("/ram"); + + return 1; + +} + int main(int argc, char *argv[]) { //return long_test(argc,argv); @@ -683,6 +710,8 @@ int main(int argc, char *argv[]) //return cache_bypass_bug_test(); - return free_space_check(); + // return free_space_check(); + + return BeatsTest(); }