2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002-2010 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Timothy Manning <timothy@yaffs.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
15 static char message[200];
16 static int PRINT_LEVEL = 3;
17 static int exit_on_error_val =1;
19 int get_exit_on_error(void)
21 return exit_on_error_val;
24 void set_exit_on_error(int val)
26 exit_on_error_val=val;
29 node * linked_list_add_node(int pos,node *head_node)
33 new_node=malloc(sizeof(node));
34 memset(new_node, NULL, sizeof(node));
35 new_node->string=NULL;
36 new_node->next=head_node;
42 void node_print_pointers(node *current_node)
44 while (current_node != NULL){
45 sprintf(message,"current_node: %p, string: %s next_node: %p\n",current_node,current_node->string,current_node->next);
46 print_message(3,message);
47 current_node=current_node->next;
51 int delete_linked_list(node *head_node)
54 node *current_node=head_node;
56 while (current_node != NULL){
57 next_node=current_node->next;
59 current_node=next_node;
65 char * generate_random_string(unsigned int length)
67 char string[length+1];
69 for (x=0;x<(length-1);x++)
71 string[x]=(rand() % NAME_RANGE)+65;
76 void set_print_level(int new_level)
78 PRINT_LEVEL=new_level;
80 int get_print_level(void)
84 void print_message(char print_level,char *message)
86 if (print_level <= PRINT_LEVEL){
90 unsigned int random_int(void)
92 return (random()%4294967295);
95 void check_function(int output)
98 print_message(3,"test_passed\n");
100 print_message(3,"test_failed\n");
105 void get_error_linux(void)
112 sprintf(message,"linux_error code %d\n",error_code);
113 print_message(1,message);
115 strcpy(message,"error is");
117 // sprintf(message,"error is : %s\n",yaffs_error_to_str(error_code));
119 //print_message(1,message);