yaffs Change stat to lstats in test code
[yaffs2.git] / direct / basic-test / dtest.c
index 3ac5604284dbd3c3a577aabc19c48d47f9685861..b954699a56a84f6a6e4bdb470c4283dff6e21dd8 100644 (file)
@@ -19,6 +19,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <time.h>
 
 #include "yaffsfs.h"
 
@@ -28,9 +29,7 @@ extern int yaffs_traceMask;
 
 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];
@@ -52,7 +51,7 @@ void copy_in_a_file(char *yaffsName,char *inName)
        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;
@@ -401,7 +400,8 @@ void fill_disk(const char *path,int nfiles)
        int n;
        int result;
        int f;
-       
+
+        static char xx[600];   
        char str[50];
        
        for(n = 0; n < nfiles; n++)
@@ -481,7 +481,7 @@ void fill_files(const char *path,int flags, int maxIterations,int siz)
        }
 }
 
-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];
@@ -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);
@@ -1498,7 +1498,7 @@ void long_name_test(const char *mountpt)
        char name[300];
        int result = 0;
        
-       int d,f;
+       int f;
        
        // Make a 256 byte name
        memset(name,0,sizeof(name));
@@ -1602,7 +1602,6 @@ void lookup_test(const char *mountpt)
 
 void link_test0(const char *mountpt)
 {
-       int i;
        char namea[300];
        char nameb[300];
        int result = 0;
@@ -2176,7 +2175,7 @@ void small_overwrite_test(const char *mountpt,int nmounts)
 
 void seek_overwrite_test(const char *mountpt,int nmounts)
 {
-
+        static char xx[5000];
        char a[30];
        
        int i;
@@ -2556,7 +2555,6 @@ void basic_xattr_test(const char *mountpt)
        int h;
        int result;
        int val1;
-       int valread;
 
        yaffs_StartUp();
 
@@ -2607,7 +2605,6 @@ void big_xattr_test(const char *mountpt)
        int h;
        int result;
        char val[1000];
-       char valread[1000];
 
        yaffs_StartUp();