X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Ftimothy_tests%2Fdev%2Ferror_handler.c;fp=direct%2Ftimothy_tests%2Fdev%2Ferror_handler.c;h=0000000000000000000000000000000000000000;hp=a9152f3a2dc1c7c301fe6e3db7b6934428fb479d;hb=121c055437f23d9d6bc7b57d36ecf128b447013f;hpb=d7388fb75a13610d14d0afc397f826bd44c972e1 diff --git a/direct/timothy_tests/dev/error_handler.c b/direct/timothy_tests/dev/error_handler.c deleted file mode 100644 index a9152f3..0000000 --- a/direct/timothy_tests/dev/error_handler.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * YAFFS: Yet another FFS. A NAND-flash specific file system. - * - * Copyright (C) 2002-2011 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. - */ - -/* - * error_handler.c contains code for checking yaffs function calls for errors. - */ -#include "error_handler.h" - - -typedef struct error_codes_template { - int code; - char * text; -}error_entry; - -const error_entry error_list[] = { - { ENOMEM , "ENOMEM" }, - { EBUSY , "EBUSY"}, - { ENODEV , "ENODEV"}, - { EINVAL , "EINVAL"}, - { EBADF , "EBADF"}, - { EACCES , "EACCES"}, - { EXDEV , "EXDEV" }, - { ENOENT , "ENOENT"}, - { ENOSPC , "ENOSPC"}, - { ERANGE , "ERANGE"}, - { ENODATA, "ENODATA"}, - { ENOTEMPTY, "ENOTEMPTY"}, - { ENAMETOOLONG,"ENAMETOOLONG"}, - { ENOMEM , "ENOMEM"}, - { EEXIST , "EEXIST"}, - { ENOTDIR , "ENOTDIR"}, - { EISDIR , "EISDIR"}, - { 0, NULL } -}; - -const char * error_to_str(int err) -{ - error_entry *e = error_list; - if (err < 0) - err = -err; - while(e->code && e->text){ - if(err == e->code) - return e->text; - e++; - } - return "Unknown error code"; -} - -void yaffs_check_for_errors(char output, buffer *message_buffer,char error_message[],char success_message[]){ - char dummy[10]; - unsigned int x=0; - int yaffs_error=-1; - char error_found=0; - if (output==-1) - { - 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,NPRINT); - yaffs_error=yaffs_get_error(); - append_int_to_buffer(message_buffer, yaffs_error,MESSAGE_LEVEL_ERROR,PRINT); - - add_to_buffer(message_buffer, error_to_str(yaffs_error),MESSAGE_LEVEL_ERROR,NPRINT); - append_to_buffer(message_buffer, "\n\n",MESSAGE_LEVEL_ERROR,PRINT); - quit_program(); - //scanf("%c",dummy); /*this line causes a segmentation fault. Need a better way of waiting for a key press*/ - //print_buffer(message_buffer,PRINT_ALL); - - } - else{ - add_to_buffer(message_buffer, success_message,MESSAGE_LEVEL_BASIC_TASKS,PRINT); - } -} - -