From: Charles Manning Date: Fri, 7 Jan 2011 01:19:08 +0000 (+1300) Subject: Merge branch 'mainlining' X-Git-Tag: linux-mainline-patchset-4~5^2~5 X-Git-Url: https://yaffs.net/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=2823629db2a6035df16d464a95ea5c183a8de484;hp=66cf3cb88e161702e6bb8e1a98a79fc0c9e564d5 Merge branch 'mainlining' --- 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..88c509f 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} } }; @@ -62,9 +64,9 @@ int main(int argc, char *argv[]) print_message(3,message); sprintf(message,"yaffs_num_of_tests: %d\n",yaffs_tests.num_of_tests); print_message(3,message); - for (x=0;xd_name); + } + } + } + + linux_open_dir = opendir(linux_struct.root_path); + if (linux_open_dir){ + 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. + + char linux_file_list[x][100]; + + for (x=0 ;NULL!=linux_current_file;x++) + { + linux_current_file =readdir(linux_open_dir); + if (NULL!=linux_current_file){ + strcpy(linux_file_list[x],linux_current_file->d_name); + } + } + } + + + + + + //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 +337,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..208f845 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 @@ -38,7 +41,7 @@ void init(int argc, char *argv[]); -int run_random_test(void); +int run_random_test(int num_of_random_tests); int compare_linux_and_yaffs(void); void get_error_yaffs(void); void get_error_linux(void); @@ -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 diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index 85df2d7..9feecdf 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -866,7 +866,7 @@ static void yaffs_evict_inode(struct inode *inode) yaffs_trace(YAFFS_TRACE_OS, "yaffs_evict_inode: ino %d, count %d %s", (int)inode->i_ino, atomic_read(&inode->i_count), - obj ? "object exists" : "null object")); + obj ? "object exists" : "null object"); if (!inode->i_nlink && !is_bad_inode(inode)) deleteme = 1; diff --git a/yaffs_vfs_single.c b/yaffs_vfs_single.c index d5b8753..2cd6047 100644 --- a/yaffs_vfs_single.c +++ b/yaffs_vfs_single.c @@ -59,9 +59,6 @@ #include -#define UnlockPage(p) unlock_page(p) -#define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags) - #define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf) #define YPROC_ROOT NULL @@ -1177,7 +1174,7 @@ static int yaffs_readpage_nolock(struct file *f, struct page *pg) static int yaffs_readpage_unlock(struct file *f, struct page *pg) { int ret = yaffs_readpage_nolock(f, pg); - UnlockPage(pg); + unlock_page(pg); return ret; } @@ -1334,7 +1331,7 @@ static int yaffs_write_begin(struct file *filp, struct address_space *mapping, } yaffs_trace(YAFFS_TRACE_OS, "start yaffs_write_begin index %d(%x) uptodate %d", - (int)index, (int)index, Page_Uptodate(pg) ? 1 : 0); + (int)index, (int)index, PageUptodate(pg) ? 1 : 0); /* Get fs space */ space_held = yaffs_hold_space(filp); @@ -1346,7 +1343,7 @@ static int yaffs_write_begin(struct file *filp, struct address_space *mapping, /* Update page if required */ - if (!Page_Uptodate(pg)) + if (!PageUptodate(pg)) ret = yaffs_readpage_nolock(filp, pg); if (ret) diff --git a/yportenv_multi.h b/yportenv_multi.h index 4dddf63..10e284e 100644 --- a/yportenv_multi.h +++ b/yportenv_multi.h @@ -24,7 +24,9 @@ #define MTD_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) +#ifdef YAFFS_OUT_OF_TREE #include "moduleconfig.h" +#endif #include #define MTD_VERSION_CODE LINUX_VERSION_CODE @@ -75,7 +77,7 @@ #endif #define yaffs_trace(msk, fmt, ...) do { \ - if(yaffs_trace_mask & ((msk) | YAFFS_TRACE_ALWAYS)) \ + if(yaffs_trace_mask & (msk)) \ printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \ } while(0) diff --git a/yportenv_single.h b/yportenv_single.h index 236f579..8183425 100644 --- a/yportenv_single.h +++ b/yportenv_single.h @@ -54,7 +54,7 @@ #endif #define yaffs_trace(msk, fmt, ...) do { \ - if(yaffs_trace_mask & ((msk) | YAFFS_TRACE_ALWAYS)) \ + if(yaffs_trace_mask & (msk)) \ printk(KERN_DEBUG "yaffs: " fmt "\n", ##__VA_ARGS__); \ } while(0)