From: John Hodge Date: Sat, 26 Sep 2009 03:02:29 +0000 (+0800) Subject: Removed debug from ata, modules, vfs/dir.c and rootfs. Also moved '#if DEBUG' to... X-Git-Tag: rel0.06~490 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=8fef00cfab98773a519ab909fa9da9dc7af692db;p=tpg%2Facess2.git Removed debug from ata, modules, vfs/dir.c and rootfs. Also moved '#if DEBUG' to common.h --- diff --git a/Kernel/drv/ata_x86.c b/Kernel/drv/ata_x86.c index ae6c55f1..c2c5205c 100644 --- a/Kernel/drv/ata_x86.c +++ b/Kernel/drv/ata_x86.c @@ -2,6 +2,7 @@ * Acess2 IDE Harddisk Driver * drv/ide.c */ +#define DEBUG 0 #include #include #include diff --git a/Kernel/include/common.h b/Kernel/include/common.h index 8b8d5a5e..3dcab289 100644 --- a/Kernel/include/common.h +++ b/Kernel/include/common.h @@ -47,9 +47,15 @@ extern void Debug_Enter(char *FuncName, char *ArgTypes, ...); extern void Debug_Log(char *FuncName, char *Fmt, ...); extern void Debug_Leave(char *FuncName, char RetType, ...); extern void Debug_HexDump(char *Header, void *Data, Uint Length); -#define ENTER(_types...) Debug_Enter((char*)__func__, _types) -#define LOG(_fmt...) Debug_Log((char*)__func__, _fmt) -#define LEAVE(_t...) Debug_Leave((char*)__func__, _t) +#if DEBUG +# define ENTER(_types...) Debug_Enter((char*)__func__, _types) +# define LOG(_fmt...) Debug_Log((char*)__func__, _fmt) +# define LEAVE(_t...) Debug_Leave((char*)__func__, _t) +#else +# define ENTER(...) +# define LOG(...) +# define LEAVE(...) +#endif // --- IO --- extern void outb(Uint16 Port, Uint8 Data); extern void outw(Uint16 Port, Uint16 Data); diff --git a/Kernel/modules.c b/Kernel/modules.c index 91afc262..b7209fff 100644 --- a/Kernel/modules.c +++ b/Kernel/modules.c @@ -90,9 +90,6 @@ int Module_LoadFile(char *Path, char *ArgString) return 0; } - LOG("info = %p\n", info); - Debug_HexDump("info", info, 6*4); - // Check magic number if(info->Magic != MODULE_MAGIC) { diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index 15f90b61..22249ef6 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -1,7 +1,11 @@ /* + * Acess2 VFS + * - Directory Management Functions */ -#include "vfs.h" -#include "vfs_int.h" +#define DEBUG 0 +#include +#include +#include // === IMPORTS === extern tVFS_Mount *gRootMount; @@ -34,7 +38,7 @@ int VFS_MkNod(char *Path, Uint Flags) tVFS_Node *parent; int ret; - Debug_Enter("VFS_MkNod", "sPath xFlags", Path, Flags); + ENTER("sPath xFlags", Path, Flags); absPath = VFS_GetAbsPath(Path); @@ -54,15 +58,15 @@ int VFS_MkNod(char *Path, Uint Flags) if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) { if(parent->Close) parent->Close( parent ); free(absPath); - Debug_Leave("VFS_MkNod", 'i', -1); + LEAVE('i', -1); return -1; } - Debug_Log("VFS_MkNod", "parent = %p\n", parent); + LOG("parent = %p\n", parent); if(parent->MkNod == NULL) { Warning("VFS_MkNod - Directory has no MkNod method"); - Debug_Leave("VFS_MkNod", 'i', -1); + LEAVE('i', -1); return -1; } @@ -76,9 +80,12 @@ int VFS_MkNod(char *Path, Uint Flags) if(parent->Close) parent->Close( parent ); // Error Check - if(ret == 0) return -1; + if(ret == 0) { + LEAVE('i', -1); + return -1; + } - Debug_Leave("VFS_MkNod", 'i', 0); + LEAVE('i', 0); return 0; } @@ -94,7 +101,7 @@ int VFS_Symlink(char *Name, char *Link) int fp; tVFS_Node *destNode; - //LogF("vfs_symlink: (name='%s', link='%s')\n", name, link); + //ENTER("sName sLink", Name, Link); // Get absolue path name Link = VFS_GetAbsPath( Link ); diff --git a/Kernel/vfs/fs/root.c b/Kernel/vfs/fs/root.c index 9f29ce23..e27c6368 100644 --- a/Kernel/vfs/fs/root.c +++ b/Kernel/vfs/fs/root.c @@ -73,12 +73,15 @@ int Root_MkNod(tVFS_Node *Node, char *Name, Uint Flags) tRamFS_File *child = parent->Data.FirstChild; tRamFS_File *prev = (tRamFS_File *) &parent->Data.FirstChild; - Log("Root_MkNod: (Node=%p, Name='%s', Flags=0x%x)", Node, Name, Flags); + ENTER("pNode sName xFlags", Node, Name, Flags); // Find last child, while we're at it, check for duplication for( ; child; prev = child, child = child->Next ) { - if(strcmp(child->Name, Name) == 0) return 0; + if(strcmp(child->Name, Name) == 0) { + LEAVE('i', 0); + return 0; + } } child = Root_int_AllocFile(); @@ -110,6 +113,7 @@ int Root_MkNod(tVFS_Node *Node, char *Name, Uint Flags) parent->Node.Size ++; + LEAVE('i', 1); return 1; } @@ -181,12 +185,12 @@ Uint64 Root_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) { void *tmp = realloc( file->Data.Bytes, Offset + Length ); if(tmp == NULL) { - Warning("Root_Write - Increasing buffer size failed\n"); + Warning("Root_Write - Increasing buffer size failed"); return -1; } file->Data.Bytes = tmp; Node->Size = Offset + Length; - Log(" Root_Write: Expanded buffer to %i bytes\n", Node->Size); + //LOG("Expanded buffer to %i bytes", Node->Size); } memcpy(file->Data.Bytes+Offset, Buffer, Length);