Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
[yaffs2.git] / direct / dtest.c
index 6f6da7451081f62fba0595077e91bc11862f5e22..792c67ef35c539d7b5cd5a6021e723d9ba688101 100644 (file)
@@ -513,7 +513,7 @@ void dumpDirFollow(const char *dname)
                        
                        yaffs_stat(str,&s);
                        
-                       printf("%s length %d mode %X ",de->d_name,(int)s.st_size,s.st_mode);
+                       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)
                        {
                                case S_IFREG: printf("data file"); break;
@@ -948,6 +948,11 @@ void rename_over_test(const char *mountpt)
        yaffs_StartUp();
        
        yaffs_mount(mountpt);
+       
+       printf("Existing files\n");
+       dumpDirFollow(mountpt);
+       
+       
        i = yaffs_open(a,O_CREAT | O_TRUNC | O_RDWR, 0); 
        yaffs_close(i);
        i = yaffs_open(b,O_CREAT | O_TRUNC | O_RDWR, 0);
@@ -961,6 +966,7 @@ void rename_over_test(const char *mountpt)
        
 }
 
+
 int resize_stress_test(const char *path)
 {
    int a,b,i,j;
@@ -1024,6 +1030,28 @@ int resize_stress_test(const char *path)
    
 }
 
+int root_perm_remount(const char *path)
+{
+   struct yaffs_stat s;
+   
+   yaffs_StartUp();
+   
+   yaffs_mount(path);
+   
+   yaffs_stat(path,&s);
+   printf("root perms after mount %x\n",s.st_mode);
+   
+   yaffs_chmod(path, 0777);
+
+   yaffs_stat(path,&s);
+   printf("root perms after setting to 0777 is  %x\n",s.st_mode);
+   
+   yaffs_unmount(path);
+      
+   return 0;
+   
+}
+
 
 int resize_stress_test_no_grow_complex(const char *path,int iters)
 {
@@ -2254,14 +2282,16 @@ int main(int argc, char *argv[])
        
        //return cache_read_test();
        
-       resize_stress_test_no_grow("/flash/flash",20);
+       // resize_stress_test_no_grow("/flash/flash",20);
+       //root_perm_remount("/flash/flash");
        
        //huge_directory_test_on_path("/ram2k");
        
         //yaffs_backward_scan_test("/flash/flash");
        // yaffs_device_flush_test("/flash/flash");
 
-        
+       rename_over_test("/flash/yaffs1");
+       
         //scan_pattern_test("/flash",10000,10);
        //short_scan_test("/flash/flash",40000,200);
          //small_mount_test("/flash/flash",1000);