--- /dev/null
+Readme for the yaffs_browser.py file
+by Timothy Manning <timothy@yaffs.net> 2010
+
+to run yaffs_browser:
+ python yaffs_browser.py
+
+
+the yaffs browser is a gui interface used for browsing a yaffs emfile.
+python and tkinter must be installed for browser to run.
+ sudo apt-get install python python-tk
+
+the yaffs_browser.py file must be run in yaffs/direct/python/ directory due to linking issues with python.
+
+browsing other emfiles
+ yaffs will mount the emfile in the same directory as the browser as default
+ to look at a emfile in a diffrent directory create a symbolic link to the emfile you wish to browse.
+ ln -s [target path] [emfile name]
+
+
+
+TODO list
+ Add scroll bars to all windows.
+ Add Ctrl + S short cut to save a file
+ Make the brower and editor window entry and list boxes resize when the window is maximized.
+
Readme for the yaffs_import.py file
+by Timothy Manning <timothy@yaffs.net> 2010
python yaffs_import [scanning_path] [optional flags]
example:
$ yaffs_importer.py /home/timothy/work/yaffs/
+yaffs_import.py must be run in yaffs/direct/python/ directory.
flags:
-d [number]
the emfile-2k-0 file. this file is stored in the
yaffs2/direct/python/ folder.
the command is: rm emfile-2k-0
+
+TODO list
+ Add fix the problem of yaffs_write() returning -1 when the disk is full.(generate a error message)
+ Add a yaffs error code refrence (prints a text message about the error)
+
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.
+ *
+ * error_handler.c contains code for checking yaffs function calls for errors.
+ */
#include "error_handler.h"
void yaffs_check_for_errors(char output, buffer *message_buffer,char error_message[],char success_message[])
{
+ char dummy='0';
if (output==-1)
{
- add_to_buffer(message_buffer, "error##########",MESSAGE_LEVEL_ERROR);
- add_to_buffer(message_buffer, error_message,MESSAGE_LEVEL_ERROR);
- add_to_buffer(message_buffer, "error_code",MESSAGE_LEVEL_ERROR);
- if (MESSAGE_LEVEL_ERROR<=DEBUG_LEVEL) printf("%d\n",yaffs_get_error()); /*cannot yet add int types to buffer. this is a quick fix*/
-
+ add_to_buffer(message_buffer, "\nerror##########",MESSAGE_LEVEL_ERROR,PRINT);
+ add_to_buffer(message_buffer, error_message,MESSAGE_LEVEL_ERROR,PRINT);
+ add_to_buffer(message_buffer, "error_code: ",MESSAGE_LEVEL_ERROR,PRINT);
+ if (MESSAGE_LEVEL_ERROR<=DEBUG_LEVEL) printf("%d\n\n\n",yaffs_get_error()); /*cannot yet add int types to buffer. this is a quick fix*/
+ scanf("%c",dummy);
//print_buffer(message_buffer,PRINT_ALL);
-
+
}
else{
- add_to_buffer(message_buffer, success_message,MESSAGE_LEVEL_BASIC_TASKS);
+ add_to_buffer(message_buffer, success_message,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
}
}
+/*
+ * 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 timothy@yaffs.net
+ *
+ * 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.
+ *
+ */
+
#ifndef __error_handler_h__
#define __error_handler_h__
#include <stdio.h>
--- /dev/null
+Found bugs in yaffs
+
+Error code 0 bug (run out of handles)
+ By opening lots of files and not closing them yaffs can run out of handles.
+ The error code given by yaffs_get_error() returns 0. this error is not defined in yportenv.h
+
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.
+ *
+ * message_buffer.c contains code for a message buffer .
+ */
+
#include "message_buffer.h"
+void append_to_buffer(buffer *p_Buffer, char *message,char message_level,char print){
+ /*wrapper function for add_to_buffer_root_function*/
+ add_to_buffer_root_function(p_Buffer,message, message_level,APPEND_MESSAGE,print);
+}
-void add_to_buffer(buffer *p_Buffer, char *message,char message_level){
- unsigned int x=0;
- /*move the head up one. the head always points at the last written data*/
- p_Buffer->head++;
+void add_to_buffer(buffer *p_Buffer, char *message,char message_level,char print){
+ /*wrapper function for add_to_buffer_root_function*/
+ add_to_buffer_root_function(p_Buffer,message, message_level,DO_NOT_APPEND_MESSAGE,print);
+}
-// printf("p_Buffer->tail=%d\n",p_Buffer->tail);
-// printf("p_Buffer->head=%d\n",p_Buffer->head);
- if (p_Buffer->head >=BUFFER_SIZE-1) {
-// printf("buffer overflow\n");
- p_Buffer->head -= (BUFFER_SIZE-1); /*wrap the head around the buffer*/
-// printf("new p_Buffer->head=%d\n",p_Buffer->head);
- }
- /*if the buffer is full then delete last entry by moving the tail*/
- if (p_Buffer->head==p_Buffer->tail){
-// printf("moving buffer tail from %d to ",p_Buffer->tail);
- p_Buffer->tail++;
- if (p_Buffer->tail >=BUFFER_SIZE) p_Buffer->tail -= BUFFER_SIZE;/*wrap the tail around the buffer*/
-// printf("%d\n",p_Buffer->tail);
+void add_to_buffer_root_function(buffer *p_Buffer, char *message,char message_level,char append,char print){
+ if (append==APPEND_MESSAGE){ /* append current message*/
+ strncat(p_Buffer->message[p_Buffer->head],message,BUFFER_MESSAGE_LENGTH);
}
+ else {
+ /*move the head up one. the head always points at the last written data*/
+ p_Buffer->head++;
+ /*printf("p_Buffer->tail=%d\n",p_Buffer->tail);*/
+ /*printf("p_Buffer->head=%d\n",p_Buffer->head);*/
+ if (p_Buffer->head >=BUFFER_SIZE-1) {
+ /*printf("buffer overflow\n");*/
+ p_Buffer->head -= (BUFFER_SIZE-1); /*wrap the head around the buffer*/
+ /*printf("new p_Buffer->head=%d\n",p_Buffer->head);*/
+ }
+ /*if the buffer is full then delete last entry by moving the tail*/
+ if (p_Buffer->head==p_Buffer->tail){
+ /*printf("moving buffer tail from %d to ",p_Buffer->tail);*/
+ p_Buffer->tail++;
+ if (p_Buffer->tail >=BUFFER_SIZE) p_Buffer->tail -= BUFFER_SIZE;/*wrap the tail around the buffer*/
+ /*printf("%d\n",p_Buffer->tail);*/
+ }
-
-
-
- p_Buffer->message_level[p_Buffer->head]=message_level; /*copy the message level*/
- x=p_Buffer->head;
-
-
-
- strcpy(p_Buffer->message[p_Buffer->head],message); /*copy the message*/
-// printf("copied %s into p_Buffer->message[p_Buffer->head]: %s\n",message,p_Buffer->message[p_Buffer->head]);
-// printf("extra %s\n",p_Buffer->message[p_Buffer->head]);
-
- if (p_Buffer->message_level[p_Buffer->head]<=DEBUG_LEVEL){
-// printf("printing buffer 1\n");
- /* the print buffer sfunction is not working this is just a quick fix*/
-// print_buffer(p_Buffer,1); /*if the debug level is higher enough then print the new message*/
+ p_Buffer->message_level[p_Buffer->head]=message_level; /*copy the message level*/
+ strncpy(p_Buffer->message[p_Buffer->head],message,BUFFER_MESSAGE_LENGTH); /*copy the message*/
+ /*printf("copied %s into p_Buffer->message[p_Buffer->head]: %s\n",message,p_Buffer->message[p_Buffer->head]);
+ printf("extra %s\n",p_Buffer->message[p_Buffer->head]);*/
+ }
+ if ((p_Buffer->message_level[p_Buffer->head]<=DEBUG_LEVEL)&& (print==PRINT)){
+ /*printf("printing buffer 1\n");
+ // the print buffer function is not working this is just a quick fix
+ print_buffer(p_Buffer,1); //if the debug level is higher enough then print the new message
+ */
printf("%s\n",p_Buffer->message[p_Buffer->head]);
}
}
+
+
+
void print_buffer(buffer *p_Buffer, int number_of_messages_to_print){
int x=0;
int i=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.
+ *
+ */
+
#ifndef __message_buffer__
#define __message_buffer__
#include <stdio.h>
#include <string.h>
-
+#define PRINT 1
+#define NPRINT 0
+#define APPEND_MESSAGE 1
+#define DO_NOT_APPEND_MESSAGE 0
#define PRINT_ALL -1 /*this is used to print all of the messages in a buffer*/
#define BUFFER_MESSAGE_LENGTH 60 /*number of char in message*/
#define BUFFER_SIZE 50 /*number of messages in buffer*/
}buffer;
#include "error_handler.h" /*include this for the debug level*/
-void add_to_buffer(buffer *p_Buffer, char *message,char message_level); /*code for buffer*/
+
void print_buffer(buffer *p_Buffer,int number_of_messages_to_print); /*print messages in the buffer*/
+/*wrapper functions for add_to_buffer_root_function*/
+void add_to_buffer(buffer *p_Buffer, char *message,char message_level,char print);
+void append_to_buffer(buffer *p_Buffer, char *message,char message_level,char print);
+void add_to_buffer_root_function(buffer *p_Buffer, char *message,char message_level,char append,char print);
#endif
-/*yaffs_tester.c*/
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.
+ *
+ * yaffs_tester.c designed to stress test yaffs2 direct.
+ */
+
#include "yaffs_tester.h"
void init(char *yaffs_test_dir,char *yaffs_mount_dir){
+ char output=0;
/*these variables are already set to zero, but it is better not to take chances*/
message_buffer.head=0;
message_buffer.tail=0;
- add_to_buffer(&message_buffer,"welcome to the yaffs tester",MESSAGE_LEVEL_BASIC_TASKS);/* print boot up message*/
+ add_to_buffer(&message_buffer,"welcome to the yaffs tester",MESSAGE_LEVEL_BASIC_TASKS,PRINT);/* print boot up message*/
yaffs_start_up();
yaffs_mount(yaffs_mount_dir);
if (yaffs_access(yaffs_test_dir,0))
{
- yaffs_mkdir(yaffs_test_dir,S_IREAD | S_IWRITE);
+ add_to_buffer(&message_buffer,"creating dir: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+ append_to_buffer(&message_buffer,yaffs_test_dir,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
+ output=yaffs_mkdir(yaffs_test_dir,S_IREAD | S_IWRITE);
+ yaffs_check_for_errors(output, &message_buffer,"could not create dir","created dir\n\n");
}
}
printf("strlen path2:%d\n",strlen(path2));
printf("path1; %s\n",path1);
*/
- //add_to_buffer(&message_buffer, "joining paths\0",MESSAGE_LEVEL_BASIC_TASKS);
- add_to_buffer(&message_buffer,path1,MESSAGE_LEVEL_BASIC_TASKS);
- add_to_buffer(&message_buffer, path2,MESSAGE_LEVEL_BASIC_TASKS);
+ add_to_buffer(&message_buffer, "joining paths:",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+ append_to_buffer(&message_buffer,path1,MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+ append_to_buffer(&message_buffer, " and ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+ append_to_buffer(&message_buffer, path2,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
if ( (path1[(sizeof(path1)/sizeof(char))-2]=='/') && path2[0]!='/') {
/*paths are compatiable. concatanate them. note -2 is because of \0*/
strcat(new_path,path1);
path[0]='\0';// this should clear the path
generate_random_string(name);
join_paths(yaffs_test_dir,name,path);
- add_to_buffer(&message_buffer,"trying to open file",MESSAGE_LEVEL_BASIC_TASKS);
- add_to_buffer(&message_buffer,path,MESSAGE_LEVEL_BASIC_TASKS);
+ add_to_buffer(&message_buffer,"trying to open file: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+ append_to_buffer(&message_buffer,path,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
output=yaffs_open(path,O_CREAT | O_TRUNC| O_RDWR, S_IREAD | S_IWRITE);
yaffs_check_for_errors(output, &message_buffer,"failed to open file","opened file");
}
void generate_random_string(char *ptr){
unsigned int x;
unsigned int length=((rand() %MAX_FILE_NAME_SIZE)+1); /*creates a int with the number of charecters been between 1 and 51*/
+ char letter='\0';
//printf("generating string\n");
//printf("string length is %d\n",length);
for (x=0; x <= (length-2) &&length>2 ; x++)
{
//printf("x=%d\n",x);
- ptr[x]=(rand() % 126-32)+32; /*generate a number between 32 and 126 and uses it as a charecter (letter) */
+ /* keep generating a charecter until the charecter is legal*/
+ while((letter=='\0' )||(letter=='/')||(letter=='\\')){
+ letter=(rand() % 126-32)+32; /*generate a number between 32 and 126 and uses it as a charecter (letter) */
+ }
+ ptr[x]=letter;
//printf("charecter generated is %c\n",ptr[x]);
}
ptr[x+1]='\0'; /*adds NULL charecter to turn it into a string*/
-/*yaffs_tester.h */
+/*
+ * 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 timothy@yaffs.net
+ *
+ * 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.
+ *
+ */
+
#ifndef __YAFFS_TESTER_H__
#define __YAFFS_TESTER_H__