エラーログのフォーマットを変更してユーザ領域を213byteまで拡張

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2401 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
aoki_ryoma 2008-09-04 06:30:38 +00:00
parent 74837ff6bd
commit 9437150004
4 changed files with 27 additions and 15 deletions

View File

@ -28,15 +28,14 @@
#define ERRORLOG_DIRECTORYPATH "nand:/sys/log"
#define ERRORLOG_FILEPATH "nand:/sys/log/sysmenu.log"
#define ERRORLOG_BAR "===================="
#define ERRORLOG_BAR_LENGTH 20
#define ERRORLOG_WRITE_FORMAT_RED1 ERRORLOG_BAR"\n#RED %02u-%02u-%02u[%3s] %02u:%02u:%02u\n"
#define ERRORLOG_HEADER_SIZE 6
#define ERRORLOG_WRITE_FORMAT_RED1 "\n\n#RED %02u-%02u-%02u[%3s] %02u:%02u:%02u\n"
#define ERRORLOG_WRITE_FORMAT_RED2 "title: %04s ErrorCode: %u\n%s"
#define ERRORLOG_WRITE_FORMAT1 ERRORLOG_BAR"\n#FFT %02u-%02u-%02u[%3s] %02u:%02u:%02u\n"
#define ERRORLOG_WRITE_FORMAT1 "\n\n#FFT %02u-%02u-%02u[%3s] %02u:%02u:%02u\n"
#define ERRORLOG_WRITE_FORMAT2 "title: %04s\n%s"
#define ERRORLOG_READ_FORMAT_RED1 ERRORLOG_BAR"\n#RED %d-%d-%d[%3s] %d:%d:%d\n"
#define ERRORLOG_READ_FORMAT_RED1 "\n\n#RED %d-%d-%d[%3s] %d:%d:%d\n"
#define ERRORLOG_READ_FORMAT_RED2 "title: %4s ErrorCode: %u\n%*s"
#define ERRORLOG_READ_FORMAT1 ERRORLOG_BAR"\n#FFT %d-%d-%d[%3s] %d:%d:%d\n"
#define ERRORLOG_READ_FORMAT1 "\n\n#FFT %d-%d-%d[%3s] %d:%d:%d\n"
#define ERRORLOG_READ_FORMAT2 "title: %4s\n%s"
#define ERRORLOG_WRITE_FORMAT ERRORLOG_WRITE_FORMAT1 ERRORLOG_WRITE_FORMAT2
@ -46,7 +45,7 @@
#define ERRORLOG_NUM_ARGS 9
#define ERRORLOG_STR_OFFSET 61
#define ERRORLOG_STR_OFFSET 42
@ -62,6 +61,7 @@ typedef enum CheckStatus {
ErrorLogWork elWork;
static BOOL isInitialized = FALSE;
/*-- function prototype ----------------------*/
CheckStatus ERRORLOGi_CheckAndCreateDirectory( const char *path );
CheckStatus ERRORLOGi_CheckAndCreateFile( const char *path );
@ -568,7 +568,7 @@ int ERRORLOGi_ReadEntry( void )
int numArgs = 0;
// 決められたファイルフォーマットからエントリに読み込む
if( ! STD_StrNCmp( "#RED", &buf[ERRORLOG_BAR_LENGTH + 1], 4 ) )
if( ! STD_StrNCmp( "\n\n#RED", buf, ERRORLOG_HEADER_SIZE ) )
{
// ランチャから書き込まれたエラーの場合
@ -589,7 +589,7 @@ int ERRORLOGi_ReadEntry( void )
elWork.entry[numEntry].titleId = MI_LoadLE32( titlebuf );
}
else if( !STD_StrNCmp( "#FFT", &buf[ERRORLOG_BAR_LENGTH + 1], 4 ) )
else if( !STD_StrNCmp( "\n\n#FFT", buf, ERRORLOG_HEADER_SIZE ) )
{
// フリーフォーマットで書き込まれたエラーの場合
if( elWork.entry[numEntry].errorStr == NULL )
@ -635,6 +635,7 @@ int ERRORLOGi_ReadEntry( void )
elWork.entry[numEntry].isBroken = TRUE;
STD_CopyLStringZeroFill( elWork.entry[numEntry].errorStr, buf, ERRORLOG_BUFSIZE+1 );
}
numEntry++;
@ -664,6 +665,7 @@ BOOL ERRORLOGi_SetString( char *buf, ErrorLogEntry *entry )
if( entry->isBroken )
{
STD_CopyLString( buf, entry->errorStr, ERRORLOG_BUFSIZE );
buf[ ERRORLOG_BUFSIZE-1 ] = '\n';
return TRUE;
}

View File

@ -19,13 +19,13 @@
SUBDIRS =
SUBMAKES = Makefile.0 Makefile.1
include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/commondefs
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build : $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------

View File

@ -48,16 +48,26 @@ void TwlMain( void )
numEntry = ERRORLOG_GetNum();
OS_TPrintf("API: before numEntry : %d\n", numEntry );
ERRORLOG_Write( (u64)0x0200040051LL );
ERRORLOG_Printf( "%d hyoooo nyoronyoro\naboooon dogaaaaaaaan", 2+5 );
ERRORLOG_Write( 0x80000 );
ERRORLOG_Printf( "this is overflow message!\nthis is overflow message!\nthis is overflow message!\n"
"this is overflow message!\nthis is overflow message!\nthis is overflow message!\n"
"this is overflow message!\nthis is overflow message!\nthis is overflow message!\n"
"this is overflow message!\nthis is overflow message!\nthis is overflow message!\n"
"this is overflow message!\nthis is overflow message!\nthis is overflow message!\n"
"this is overflow message!\nthis is overflow message!\nthis is overflow message!\n" );
/*
ERRORLOG_Write( (u64)0x77700040051LL );
ERRORLOG_Printf( "%d hyoooo nyoronyoro\naboooon dogaaaaaaaan", 2+5 );
ERRORLOG_Printf( "menuRedIplManager.cpp [l.73] RED FATAL 0" );
ERRORLOG_Printf( "this is too long long long long long long long long long long long long string.\n"
"this is too long long long long long long long long long long long long string.\n"
"this is too long long long long long long long long long long long long string.\n"
"this is too long long long long long long long long long long long long string.\n" );
*/
/*
if( numEntry > 2 )
{

View File

@ -30,7 +30,7 @@ extern "C" {
// 日付データとかを除いた、自由フォーマットで書き込めるサイズ
// このサイズを超えた文字列は切り捨てられます
// ERRORLOG_STR_LENGTH = ERRORLOG_BUFSIZE - ERRORLOG_STR_OFFSET - 1
#define ERRORLOG_STR_LENGTH 194
#define ERRORLOG_STR_LENGTH 213
#define ERRORLOG_SIZE ( 16 * 1024 ) // ファイルは16KBサイズ固定
#define ERRORLOG_BUFSIZE 256 // 1エントリあたりのサイズ
#define ERRORLOG_NUM_ENTRY ( ERRORLOG_SIZE / ERRORLOG_BUFSIZE ) // ログに書き込まれるエントリの最大数