yaffs Fixing some minor warnings in direct/timothy_tests/linux_tests
authorTimothy Manning <tfhmanning@gmail.com>
Thu, 27 Jan 2011 23:56:51 +0000 (12:56 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Thu, 27 Jan 2011 23:56:51 +0000 (12:56 +1300)
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
direct/timothy_tests/linux_tests/README.txt
direct/timothy_tests/linux_tests/lib.c
direct/timothy_tests/linux_tests/lib.h
direct/timothy_tests/linux_tests/linux_test.c
direct/timothy_tests/linux_tests/linux_test.h

index 41c2812771f701108a0c803fdfb677870cb5cdbb..0c3fa845f637d685fe6328d962fc26458563883a 100644 (file)
@@ -11,12 +11,20 @@ $ insmod yaffs2multi.ko
 $ mkdir /mnt/y
 $ mount -t yaffs2 /dev/mtdblock0 /mnt/y
 
+
+
 How to change the permissions on the nandsim partition
+
 $ sudo chmod a+wr /mnt/y/
 #check the permission change
 $ touch /mnt/y/test_file
 
 How to clean the folder
+
 $ rm -rf /mnt/y
 
-The test must me run in sudo to work
+
+The test must be run in sudo to work
+
+$ make
+$ sudo ./linux_test
index ffc9b0555f468449abca88f6702f53e0f9d824be..5f439040e3ee891677bec7cfc7168d759a80e138 100644 (file)
@@ -15,6 +15,8 @@
 static char message[200];
 static int  PRINT_LEVEL = 3;
 static int exit_on_error_val =1;
+char string[FILE_NAME_LENGTH+1];
+
 
 int get_exit_on_error(void)
 {
@@ -31,7 +33,7 @@ node * linked_list_add_node(int pos,node *head_node)
        node *new_node=NULL;
        if (pos==HEAD){
                new_node=malloc(sizeof(node));
-               memset(new_node, NULL, sizeof(node));
+               memset(new_node, 0, sizeof(node));
                new_node->string=NULL;
                new_node->next=head_node;
                return new_node;
@@ -64,7 +66,7 @@ int delete_linked_list(node *head_node)
 
 char * generate_random_string(unsigned int length)
 {
-       char string[length+1];
+
        unsigned int x;
        for (x=0;x<(length-1);x++)
        {
@@ -73,6 +75,7 @@ char * generate_random_string(unsigned int length)
        string[x]='\0';
        return string;
 }
+
 void set_print_level(int new_level)
 {
        PRINT_LEVEL=new_level;
@@ -84,12 +87,12 @@ int get_print_level(void)
 void print_message(char print_level,char *message)
 {
        if (print_level <= PRINT_LEVEL){
-               printf(message);
+               printf("%s",message);
        }
 }
-unsigned int random_int(void)
+int random_int(void)
 {
-       return (random()%4294967295);
+       return (random()%1000000); 
 }
 
 void check_function(int output)
index a47a1b80490d7b29358626cd6811836bd425a041..fa0cfbe281a669c5907c8a8b6394d1d7c1a4fdfc 100644 (file)
@@ -18,7 +18,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
-#include "yaffsfs.h"
+#include <stdlib.h>
 
 #define NAME_RANGE 10
 #define ROOT_PATH "/mnt/y/"
@@ -35,7 +35,7 @@ int get_exit_on_error(void);
 void set_exit_on_error(int val);
 int delete_linked_list(node *head_node);
 node * linked_list_add_node(int pos,node *head_node);
-unsigned int random_int(void);
+int random_int(void);
 char * generate_random_string(unsigned int length);
 void get_error_linux(void);
 void check_function(int output);
index 88732ad66a69b9931e7c98cdafd80541f80c3b22..429e74fac5d0c5f9e9335382e2f852bd39ad2a72 100644 (file)
@@ -47,7 +47,7 @@ void init(int argc, char *argv[])
        sprintf(message,"seeding srand with: %d\n",x);
        print_message(2,message);
        srand(x);
-       yaffs_set_trace(0);
+
 
 
        do {
@@ -155,7 +155,7 @@ dir_struct * scan_dir(void)
                dir->path_list->string=malloc(strlen(dir_data->d_name)+1);
                strcpy(dir->path_list->string,dir_data->d_name);
                sprintf(message,"opened file: %s\n",dir->path_list->string);
-               print_message(3,message);
+               print_message(5,message);
                dir_data=readdir(open_dir);
        }
        closedir(open_dir);
index 472449ce1208d3146cce6bb33cd270d1082d8e9c..97a634805e25cb354259da8edd0b7f9414f39d38 100644 (file)
@@ -16,8 +16,8 @@
 #ifndef __linux_test_h__
 #define __linux_test_h__
 #include <stdio.h>
+#include <stdlib.h>
 #include <dirent.h>
-#include "yaffsfs.h"
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>