yaffs: More clean up
[yaffs2.git] / direct / basic-test / dtest.c
index 779ac15ce564e4ecf2376e44f7eda9b15cc85dd8..e6a0a146916cc38be18b08fa0f20022b20d48487 100644 (file)
@@ -531,7 +531,7 @@ void dumpDirFollow(const char *dname)
                {
                        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)
@@ -741,7 +741,7 @@ int long_test(int argc, char *argv[])
        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
        
@@ -828,7 +828,7 @@ int long_test(int argc, char *argv[])
        
        // Check chmod
        
-       yaffs_stat("/boot/yyfile",&ystat);
+       yaffs_lstat("/boot/yyfile",&ystat);
        temp_mode = ystat.st_mode;
        
        yaffs_chmod("/boot/yyfile",0x55555);
@@ -1094,12 +1094,12 @@ int root_perm_remount(const char *path)
    
    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);
@@ -2516,7 +2516,7 @@ static void print_xattrib_val(const char *path, const char *name)
 
        n = yaffs_getxattr(path,name,buffer,sizeof(buffer));
        if(n >= 0){
-               __u8 *b = (__u8 *)buffer;
+               u8 *b = (u8 *)buffer;
 
                printf("%d bytes:",n);
                if(n > 10)
@@ -2642,7 +2642,7 @@ void big_xattr_test(const char *mountpt)
 }
 
 
-void dump_dev_stats(yaffs_dev_t *dev, const char * str)
+void dump_dev_stats(struct yaffs_dev *dev, const char * str)
 {
        printf("%s\n",str);
        printf( "space free %d erased %d "
@@ -2658,7 +2658,7 @@ void test_flash_traffic(const char *mountpt)
        char name0[100];
        char name1[100];
        int i;
-       yaffs_dev_t *dev;
+       struct yaffs_dev *dev;
 
        yaffs_trace_mask = 0;
 
@@ -2683,6 +2683,34 @@ void test_flash_traffic(const char *mountpt)
 
 }
 
+void link_follow_test(const char *mountpt)
+{
+       char fn[100];
+       char sn[100];
+       char hn[100];
+       int result;
+       int h;
+       
+       yaffs_trace_mask = 0;
+
+       yaffs_start_up();
+
+       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;
 
@@ -2747,6 +2775,7 @@ int main(int argc, char *argv[])
         //null_name_test("yaffs2");
 
         test_flash_traffic("yaffs2");
+        link_follow_test("/yaffs2");
 
         return 0;