From b71ce3a65f255d487f1f869ba88c6924b11ad7e5 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 28 Dec 2009 21:38:49 +0800 Subject: [PATCH] Cleanup & Debug Removal - Disabled debug in ATA driver - Fixed the return values of module initialisation functions - Cleaned up some newlines that were still around in Log() calls --- Kernel/Makefile.BuildNum | 2 +- Kernel/debug.c | 2 +- Kernel/drv/ata_x86.c | 16 ++++++++-------- Kernel/drv/fifo.c | 2 +- Kernel/drv/proc.c | 4 ++-- Kernel/drv/vterm.c | 4 ++-- Kernel/include/modules.h | 3 +++ Kernel/vfs/fs/fat.c | 4 ++-- Modules/FDD/fdd.c | 2 +- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index 60218c46..6ca12f06 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 1128 +BUILD_NUM = 1131 diff --git a/Kernel/debug.c b/Kernel/debug.c index f78ea015..3b00241a 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -223,7 +223,7 @@ void Debug_SetKTerminal(char *File) if(giDebug_KTerm != -1) VFS_Close(giDebug_KTerm); giDebug_KTerm = VFS_Open(File, VFS_OPENFLAG_WRITE); - Log("Opened '%s' as %i\n", File, giDebug_KTerm); + Log("Opened '%s' as 0x%x", File, giDebug_KTerm); } void Debug_Enter(char *FuncName, char *ArgTypes, ...) diff --git a/Kernel/drv/ata_x86.c b/Kernel/drv/ata_x86.c index 8d9e2e85..044688b9 100644 --- a/Kernel/drv/ata_x86.c +++ b/Kernel/drv/ata_x86.c @@ -2,7 +2,7 @@ * Acess2 IDE Harddisk Driver * drv/ide.c */ -#define DEBUG 1 +#define DEBUG 0 #include #include #include @@ -166,9 +166,9 @@ int ATA_Install() ATA_SetupVFS(); if( DevFS_AddDevice( &gATA_DriverInfo ) == 0 ) - return 0; + return MODULE_INIT_FAILURE; - return 1; + return MODULE_INIT_SUCCESS; } /** @@ -187,9 +187,9 @@ int ATA_SetupIO() LOG("ent = %i", ent); gATA_BusMasterBase = PCI_GetBAR4( ent ); if( gATA_BusMasterBase == 0 ) { - Warning("It seems that there is no Bus Master Controller on this machine, get one"); - LEAVE('i', 0); - return 0; + Warning("It seems that there is no Bus Master Controller on this machine. Get one"); + LEAVE('i', MODULE_INIT_FAILURE); + return MODULE_INIT_FAILURE; } if( !(gATA_BusMasterBase & 1) ) { @@ -222,8 +222,8 @@ int ATA_SetupIO() outb(IDE_PRI_BASE+1, 1); outb(IDE_SEC_BASE+1, 1); - LEAVE('i', 1); - return 1; + LEAVE('i', MODULE_INIT_SUCCESS); + return MODULE_INIT_SUCCESS; } /** diff --git a/Kernel/drv/fifo.c b/Kernel/drv/fifo.c index 953bac6a..df71823b 100644 --- a/Kernel/drv/fifo.c +++ b/Kernel/drv/fifo.c @@ -62,7 +62,7 @@ tPipe *gFIFO_NamedPipes = NULL; int FIFO_Install(char **Options) { DevFS_AddDevice( &gFIFO_DriverInfo ); - return 0; + return MODULE_INIT_SUCCESS; } /** diff --git a/Kernel/drv/proc.c b/Kernel/drv/proc.c index 9aa0a340..898deee3 100644 --- a/Kernel/drv/proc.c +++ b/Kernel/drv/proc.c @@ -108,7 +108,7 @@ tSysFS_Ent *gSysFS_FileList; int SysFS_Install(char **Options) { DevFS_AddDevice( &gSysFS_DriverInfo ); - return 0; + return MODULE_INIT_SUCCESS; } /** @@ -171,7 +171,7 @@ int SysFS_RegisterFile(char *Path, char *Data, int Length) ent->Node.Size ++; else gSysFS_DriverInfo.RootNode.Size ++; - LOG("Added directory '%s'\n", child->Name); + LOG("Added directory '%s'", child->Name); } ent = child; diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index 4095feb7..2011f1c5 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -187,7 +187,7 @@ int VT_Install(char **Arguments) // Set kernel output to VT0 Debug_SetKTerminal("/Devices/VTerm/0"); - return 0; + return MODULE_INIT_SUCCESS; } /** @@ -750,7 +750,7 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch) { int i; //ENTER("pTerm xCh", Term, Ch); - //LOG("Term = {WritePos:%i, ViewPos:%i}\n", Term->WritePos, Term->ViewPos); + //LOG("Term = {WritePos:%i, ViewPos:%i}", Term->WritePos, Term->ViewPos); switch(Ch) { diff --git a/Kernel/include/modules.h b/Kernel/include/modules.h index 68c797be..bf2dd4c5 100644 --- a/Kernel/include/modules.h +++ b/Kernel/include/modules.h @@ -33,4 +33,7 @@ typedef struct sModule { char **Dependencies; // NULL Terminated List } __attribute__((packed)) tModule; +#define MODULE_INIT_SUCCESS 1 +#define MODULE_INIT_FAILURE 0 + #endif diff --git a/Kernel/vfs/fs/fat.c b/Kernel/vfs/fs/fat.c index fab89651..041e83fc 100644 --- a/Kernel/vfs/fs/fat.c +++ b/Kernel/vfs/fs/fat.c @@ -37,7 +37,7 @@ tVFS_Node *FAT_FindDir(tVFS_Node *dirNode, char *file); void FAT_CloseFile(tVFS_Node *node); // === SEMI-GLOBALS === -MODULE_DEFINE(0, 0x51 /*v0.80*/, FAT32, FAT_Install, NULL, NULL); +MODULE_DEFINE(0, 0x51 /*v0.80*/, VFAT, FAT_Install, NULL, NULL); tFAT_VolInfo gFAT_Disks[8]; int giFAT_PartCount = 0; #if USE_LFN @@ -55,7 +55,7 @@ tVFS_Driver gFAT_FSInfo = { int FAT_Install(char **Arguments) { VFS_AddDriver( &gFAT_FSInfo ); - return 0; + return MODULE_INIT_SUCCESS; } /** diff --git a/Modules/FDD/fdd.c b/Modules/FDD/fdd.c index 2cf28b64..c087418c 100644 --- a/Modules/FDD/fdd.c +++ b/Modules/FDD/fdd.c @@ -151,7 +151,7 @@ int FDD_Install(char **Arguments) gFDD_Devices[0].track[0] = -1; gFDD_Devices[1].track[1] = -1; - Log("[FDD ] Detected Disk 0: %s and Disk 1: %s\n", cFDD_TYPES[data>>4], cFDD_TYPES[data&0xF]); + Log("[FDD ] Detected Disk 0: %s and Disk 1: %s", cFDD_TYPES[data>>4], cFDD_TYPES[data&0xF]); // Clear FDD IRQ Flag FDD_SensInt(0x3F0, NULL, NULL); -- 2.20.1