Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
authorCharles Manning <cdhmanning@gmail.com>
Thu, 13 Jan 2011 00:23:15 +0000 (13:23 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Thu, 13 Jan 2011 00:23:15 +0000 (13:23 +1300)
direct/timothy_tests/threading/lib.c
direct/timothy_tests/threading/test_a.c
direct/timothy_tests/threading/threading.c

index 6456958571e52f7991f6ef065ec5e26bf31e6138..55084a2ba5477f781f34dc02cb2203dbe28d2001 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #include "lib.h"
-static unsigned int *p_counter;
+static volatile unsigned int *p_counter;
 static unsigned int numberOfThreads=5;
 
 unsigned int get_num_of_threads(void)
@@ -37,6 +37,6 @@ void set_counter(int x, unsigned int value)
 
 void init_counter(unsigned int size_of_counter)
 {
-       p_counter=malloc(size_of_counter*sizeof(int));
+       p_counter=malloc(size_of_counter*sizeof(unsigned int));
 }
 
index 391530cf077b1b3dd34de396f198d31932c37934..5e1af5485f550039ae3d1a05940bc5130dc3b744 100644 (file)
@@ -26,7 +26,7 @@ void test_a(void *x)
        int pos;
        int n;
        int n1;
-       
+       struct yaffs_stat stat_buffer;
        char name[200];
        char name1[200];
        
@@ -90,9 +90,133 @@ void test_a(void *x)
                yaffs_rmdir(name);
                return;
        }
+       op-=1;
+       if(op < 0){
+               yaffs_rmdir(name);
+               return;
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_fsync(bc->h[i]);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_fdatasync(bc->h[i]);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_flush(bc->h[i]);
+                       return;
+               }
+       }
 
-       bc->opMax = (start_op - op -1);
-       
+       op -=1;
+       if(op < 0){
+               if((bc->h[i]>= 0) && (bc->h[i+1] < 0)){
+                       bc->h[i+1]=yaffs_dup(bc->h[i]);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_ftruncate(bc->h[i],n);
+                       return;
+               }
+       }
+
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_fstat(bc->h[i],&stat_buffer);
+                       yaffs_fchmod(bc->h[i], n);
+                       yaffs_fchmod(bc->h[i], ((S_IREAD|S_IWRITE)&(stat_buffer.st_mode)));
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_stat(name,&stat_buffer);
+                       yaffs_chmod(name, n);
+                       yaffs_chmod(name, ((S_IREAD|S_IWRITE)&(stat_buffer.st_mode)));
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_lstat(name,&stat_buffer);
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_read(bc->h[i],name,n);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_pread(bc->h[i],name,n,n1);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_write(bc->h[i],name,n);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_pwrite(bc->h[i],name,n,n1);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_truncate(name,n);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_access(name,n);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_symlink(name,name1);
+                       return;
+               }
+       }
+       op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_link(name,name1);
+                       return;
+               }
+       }
+               op -=1;
+       if(op < 0){
+               if(bc->h[i]>= 0){
+                       yaffs_unlink(name);
+                       return;
+               }
+       }
        return;         
        
 }
index 4b65e388eaefdb53b89258d75ccbc7fa50497213..d4f584b62a3fe68fc3cfb177cb3278a70fe66398 100644 (file)
@@ -74,6 +74,7 @@ int main(int argc, char *argv[])
                        printf("| %d ",get_counter(y));
                }
                printf("\n");
+               sleep(1);
        }
 
 }