summaryrefslogtreecommitdiff
path: root/direct
diff options
context:
space:
mode:
authorTimothy Manning <tfhmanning@gmail.com>2011-01-28 12:56:51 +1300
committerTimothy Manning <tfhmanning@gmail.com>2011-01-28 12:56:51 +1300
commit8cbfc1e273db791447911631e80c0495c6171ca8 (patch)
tree0ed80b764fa528f7ece4ca21ae18fa0ec740e056 /direct
parent79333a6e009cc468a6c15ff1077f3bc389fd85e9 (diff)
yaffs Fixing some minor warnings in direct/timothy_tests/linux_tests
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
Diffstat (limited to 'direct')
-rw-r--r--direct/timothy_tests/linux_tests/README.txt10
-rw-r--r--direct/timothy_tests/linux_tests/lib.c13
-rw-r--r--direct/timothy_tests/linux_tests/lib.h4
-rw-r--r--direct/timothy_tests/linux_tests/linux_test.c4
-rw-r--r--direct/timothy_tests/linux_tests/linux_test.h2
5 files changed, 22 insertions, 11 deletions
diff --git a/direct/timothy_tests/linux_tests/README.txt b/direct/timothy_tests/linux_tests/README.txt
index 41c2812..0c3fa84 100644
--- a/direct/timothy_tests/linux_tests/README.txt
+++ b/direct/timothy_tests/linux_tests/README.txt
@@ -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
diff --git a/direct/timothy_tests/linux_tests/lib.c b/direct/timothy_tests/linux_tests/lib.c
index ffc9b05..5f43904 100644
--- a/direct/timothy_tests/linux_tests/lib.c
+++ b/direct/timothy_tests/linux_tests/lib.c
@@ -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)
diff --git a/direct/timothy_tests/linux_tests/lib.h b/direct/timothy_tests/linux_tests/lib.h
index a47a1b8..fa0cfbe 100644
--- a/direct/timothy_tests/linux_tests/lib.h
+++ b/direct/timothy_tests/linux_tests/lib.h
@@ -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);
diff --git a/direct/timothy_tests/linux_tests/linux_test.c b/direct/timothy_tests/linux_tests/linux_test.c
index 88732ad..429e74f 100644
--- a/direct/timothy_tests/linux_tests/linux_test.c
+++ b/direct/timothy_tests/linux_tests/linux_test.c
@@ -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);
diff --git a/direct/timothy_tests/linux_tests/linux_test.h b/direct/timothy_tests/linux_tests/linux_test.h
index 472449c..97a6348 100644
--- a/direct/timothy_tests/linux_tests/linux_test.h
+++ b/direct/timothy_tests/linux_tests/linux_test.h
@@ -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>