#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <time.h>
#include "yaffsfs.h"
void dumpDir(const char *dname);
-char xx[600];
-
-void copy_in_a_file(char *yaffsName,char *inName)
+void copy_in_a_file(const char *yaffsName,const char *inName)
{
int inh,outh;
unsigned char buffer[100];
close(inh);
}
-void make_a_file(char *yaffsName,char bval,int sizeOfFile)
+void make_a_file(const char *yaffsName,char bval,int sizeOfFile)
{
int outh;
int i;
int n;
int result;
int f;
-
+
+ static char xx[600];
char str[50];
for(n = 0; n < nfiles; n++)
}
}
-void leave_unlinked_file(char *path,int maxIterations,int siz)
+void leave_unlinked_file(const char *path,int maxIterations,int siz)
{
int i;
char str[50];
{
sprintf(str,"%s/%s",dname,de->d_name);
- yaffs_stat(str,&s);
+ yaffs_lstat(str,&s);
printf("%s ino %d length %d mode %X ",de->d_name,(int)s.st_ino,(int)s.st_size,s.st_mode);
switch(s.st_mode & S_IFMT)
dumpDir("/boot");
// Check stat
- r = yaffs_stat("/boot/file with a long name",&ystat);
+ r = yaffs_lstat("/boot/file with a long name",&ystat);
// Check rename
// Check chmod
- yaffs_stat("/boot/yyfile",&ystat);
+ yaffs_lstat("/boot/yyfile",&ystat);
temp_mode = ystat.st_mode;
yaffs_chmod("/boot/yyfile",0x55555);
yaffs_mount(path);
- yaffs_stat(path,&s);
+ yaffs_lstat(path,&s);
printf("root perms after mount %x\n",s.st_mode);
yaffs_chmod(path, 0777);
- yaffs_stat(path,&s);
+ yaffs_lstat(path,&s);
printf("root perms after setting to 0777 is %x\n",s.st_mode);
yaffs_unmount(path);
char name[300];
int result = 0;
- int d,f;
+ int f;
// Make a 256 byte name
memset(name,0,sizeof(name));
void link_test0(const char *mountpt)
{
- int i;
char namea[300];
char nameb[300];
int result = 0;
void seek_overwrite_test(const char *mountpt,int nmounts)
{
-
+ static char xx[5000];
char a[30];
int i;
int h;
int result;
int val1;
- int valread;
yaffs_StartUp();
int h;
int result;
char val[1000];
- char valread[1000];
yaffs_StartUp();
}
+void link_follow_test(const char *mountpt)
+{
+ char fn[100];
+ char sn[100];
+ char hn[100];
+ int result;
+ int h;
+
+ yaffs_traceMask = 0;
+
+ yaffs_StartUp();
+
+ yaffs_mount(mountpt);
+
+ sprintf(fn,"%s/file",mountpt);
+ sprintf(sn,"%s/sym",mountpt);
+ sprintf(hn,"%s/hl-sym",mountpt);
+
+ h = yaffs_open(fn,O_CREAT| O_RDWR, S_IREAD | S_IWRITE);
+ result = yaffs_close(h);
+
+ result = yaffs_symlink(fn,sn);
+ result = yaffs_link(sn,hn);
+
+ h =yaffs_open(hn,O_RDWR,0);
+
+}
+
int random_seed;
int simulate_power_failure;
//null_name_test("yaffs2");
test_flash_traffic("yaffs2");
+ link_follow_test("/yaffs2");
return 0;