From: Charles Manning Date: Wed, 15 Dec 2010 02:04:38 +0000 (+1300) Subject: Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2 X-Git-Tag: linux-mainline-patchset-4~5^2~10 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=a64e1896b1d462414c9fad6dbe1f77a2a8be04a5;hp=fb619fcd9415e8a5b9c8bdad87fff07a1b2579ab Merge branch 'master' of ssh://aleph1.co.uk/home/aleph1/git/yaffs2 --- diff --git a/direct/timothy_tests/mirror_tests/Makefile b/direct/timothy_tests/mirror_tests/Makefile index d252e4b..4362cd9 100644 --- a/direct/timothy_tests/mirror_tests/Makefile +++ b/direct/timothy_tests/mirror_tests/Makefile @@ -48,7 +48,8 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ TESTFILES = mirror_tests.o lib.o\ linux_test_open.o yaffs_test_open.o\ - linux_test_truncate.o yaffs_test_truncate.o + linux_test_truncate.o yaffs_test_truncate.o \ + linux_test_unlink.o yaffs_test_unlink.o diff --git a/direct/timothy_tests/mirror_tests/linux_test_unlink.c b/direct/timothy_tests/mirror_tests/linux_test_unlink.c new file mode 100644 index 0000000..f22a57b --- /dev/null +++ b/direct/timothy_tests/mirror_tests/linux_test_unlink.c @@ -0,0 +1,33 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. + * + * Copyright (C) 2002-2010 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Timothy Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include "linux_test_unlink.h" + +int linux_test_unlink(arg_temp *args_struct) +{ + char path[250]; + char message[150]; + int output; + join_paths(linux_struct.root_path,args_struct->string1, path ); + sprintf(message,"file path: %s\n",path); + print_message(3,message); + + output= unlink(path); + + if (output<0) { + print_message(3,"failed to unlink file\n"); + return -1; + } else { + return 1; + } +} diff --git a/direct/timothy_tests/mirror_tests/linux_test_unlink.h b/direct/timothy_tests/mirror_tests/linux_test_unlink.h new file mode 100644 index 0000000..aac3bcd --- /dev/null +++ b/direct/timothy_tests/mirror_tests/linux_test_unlink.h @@ -0,0 +1,26 @@ +/* + * YAFFS: Yet another Flash File System . A NAND-flash specific file system. + * + * Copyright (C) 2002-2010 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Timothy Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 as + * published by the Free Software Foundation. + * + * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. + */ + +#ifndef __linux_test_unlink_h__ +#define __linux_test_unlink_h__ +#include +#include +#include +#include "yaffsfs.h" +#include "lib.h" + +int linux_test_unlink(arg_temp *args_struct); + +#endif diff --git a/direct/timothy_tests/mirror_tests/mirror_tests.c b/direct/timothy_tests/mirror_tests/mirror_tests.c index a022e4d..d87dff5 100644 --- a/direct/timothy_tests/mirror_tests/mirror_tests.c +++ b/direct/timothy_tests/mirror_tests/mirror_tests.c @@ -31,16 +31,18 @@ typedef struct test_temp2 { }test_temp; test_temp yaffs_tests={ - 2, + 3, {{"yaffs_test_open",yaffs_test_open}, - {"yaffs_test_truncate",yaffs_test_truncate} + {"yaffs_test_truncate",yaffs_test_truncate}, + {"yaffs_test_unlink",yaffs_test_unlink} } }; test_temp linux_tests={ - 2, + 3, {{"linux_test_open",linux_test_open}, - {"linux_test_truncate",linux_test_truncate} + {"linux_test_truncate",linux_test_truncate}, + {"linux_test_unlink",linux_test_unlink} } }; @@ -65,6 +67,7 @@ int main(int argc, char *argv[]) for (x=0;xd_name); + } + } + + linux_open_dir = opendir(linux_struct.root_path); + + for (x=0;NULL!=readdir(linux_open_dir);x++){}; + printf("number of files in linux dir= %d\n",(x-2)); //the -2 is because linux shows 2 extra files which are automaticly created. + + //printf("file_name %s\n", yaffs_current_file->d_name); // generate_array_of_objects_in_yaffs(); // generate_array_of_objects_in_linux(); //first do a check to see if both sides have the same objects on both sides. @@ -278,3 +318,37 @@ void get_error_linux(void) print_message(1,message); } +void clean_dir(void) +{ + char string[200]; + char file[200]; + char message[200]; + DIR *linux_open_dir; + struct dirent *linux_current_file; + int x=0; + + getcwd(string,200); + strcat(string,"/emfile-2k-0"); + sprintf(message,"\n\nunlinking emfile at this path: %s\n",string); + print_message(3,message); + unlink(string); + + + linux_open_dir = opendir(linux_struct.root_path); + if (linux_open_dir){ + for (x=0 ;NULL!=linux_current_file ;x++) + { + linux_current_file =readdir(linux_open_dir); + if (NULL!=linux_current_file){ + + strcpy(file,linux_struct.root_path); + strcat(file,linux_current_file->d_name); + sprintf(message,"unlinking file %d\n",linux_current_file->d_name); + print_message(3,message); + unlink(file); + } + } + unlink(linux_struct.root_path); + } + +} diff --git a/direct/timothy_tests/mirror_tests/mirror_tests.h b/direct/timothy_tests/mirror_tests/mirror_tests.h index 0ae4be5..7d8617c 100644 --- a/direct/timothy_tests/mirror_tests/mirror_tests.h +++ b/direct/timothy_tests/mirror_tests/mirror_tests.h @@ -17,6 +17,7 @@ #define __mirror_tests_h__ #include +#include #include //used for getting the current directory. #include #include @@ -24,11 +25,13 @@ #include "lib.h" #include + #include "linux_test_open.h" #include "yaffs_test_open.h" #include "linux_test_truncate.h" #include "yaffs_test_truncate.h" - +#include "linux_test_unlink.h" +#include "yaffs_test_unlink.h" #define LINUX 1 #define YAFFS 2 @@ -46,6 +49,7 @@ int select_test_id(int test_len); void generate_random_numbers(arg_temp *args_struct); void run_yaffs_test(int id,arg_temp *args_struct); void run_linux_test(int id,arg_temp *args_struct); +void clean_dir(void); //void generate_array_of_objects_in_yaffs(void); //void generate_array_of_objects_in_linux(void); diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_unlink.c b/direct/timothy_tests/mirror_tests/yaffs_test_unlink.c new file mode 100644 index 0000000..a6f1497 --- /dev/null +++ b/direct/timothy_tests/mirror_tests/yaffs_test_unlink.c @@ -0,0 +1,34 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. + * + * Copyright (C) 2002-2010 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Timothy Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include "yaffs_test_unlink.h" + +int yaffs_test_unlink(arg_temp *args_struct) +{ + char path[250]; + char message[150]; + int output; + join_paths(yaffs_struct.root_path,args_struct->string1, path ); + sprintf(message,"file path: %s\n",path); + print_message(3,message); + + output= yaffs_unlink(path); + + if (output<0) { + print_message(3,"failed to unlink file\n"); + return -1; + } else { + return 1; + } + +} diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_unlink.h b/direct/timothy_tests/mirror_tests/yaffs_test_unlink.h new file mode 100644 index 0000000..4d1b881 --- /dev/null +++ b/direct/timothy_tests/mirror_tests/yaffs_test_unlink.h @@ -0,0 +1,26 @@ +/* + * YAFFS: Yet another Flash File System . A NAND-flash specific file system. + * + * Copyright (C) 2002-2010 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Timothy Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 as + * published by the Free Software Foundation. + * + * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. + */ + +#ifndef __yaffs_test_unlink_h__ +#define __yaffs_test_unlink_h__ +#include +#include +#include +#include "yaffsfs.h" +#include "lib.h" + +int yaffs_test_unlink(arg_temp *args_struct); + +#endif