From 42fb98c5f353bf3e7cfbc202e2ace886b0c85874 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 14 Jul 2012 18:14:55 +0800 Subject: [PATCH] Kernel/VFS - Fixed logic error in MkNod (rootfs and dir.c) - Also did minor debugging changes to heap and USB keyboard --- KernelLand/Kernel/heap.c | 2 +- KernelLand/Kernel/vfs/dir.c | 13 ++++--------- KernelLand/Kernel/vfs/fs/root.c | 10 +++++----- KernelLand/Modules/USB/HID/keyboard.c | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/KernelLand/Kernel/heap.c b/KernelLand/Kernel/heap.c index cb94d876..9e291450 100644 --- a/KernelLand/Kernel/heap.c +++ b/KernelLand/Kernel/heap.c @@ -308,7 +308,7 @@ void Heap_Deallocate(void *Ptr) // Sanity check if((Uint)Ptr < (Uint)gHeapStart || (Uint)Ptr > (Uint)gHeapEnd) { - Log_Warning("Heap", "free - Passed a non-heap address by %p (%p < %p < %p)\n", + Log_Warning("Heap", "free - Passed a non-heap address by %p (%p < %p < %p)", __builtin_return_address(0), gHeapStart, Ptr, gHeapEnd); return; } diff --git a/KernelLand/Kernel/vfs/dir.c b/KernelLand/Kernel/vfs/dir.c index fcf361ec..26f6f0f4 100644 --- a/KernelLand/Kernel/vfs/dir.c +++ b/KernelLand/Kernel/vfs/dir.c @@ -99,15 +99,10 @@ int VFS_MkNod(const char *Path, Uint Flags) // Free Parent mountpt->OpenHandleCount --; _CloseNode(parent); - - // Error Check - if(ret != 0) { - LEAVE('i', -1); - return -1; - } - - LEAVE('i', 0); - return 0; + + // Return whatever the driver said + LEAVE('i', ret); + return ret; } /** diff --git a/KernelLand/Kernel/vfs/fs/root.c b/KernelLand/Kernel/vfs/fs/root.c index 4416750c..6c45f40e 100644 --- a/KernelLand/Kernel/vfs/fs/root.c +++ b/KernelLand/Kernel/vfs/fs/root.c @@ -90,15 +90,15 @@ int Root_MkNod(tVFS_Node *Node, const char *Name, Uint Flags) LOG("Sanity check name length - %i > %i", strlen(Name)+1, sizeof(child->Name)); if(strlen(Name) + 1 > sizeof(child->Name)) - LEAVE_RET('i', 0); + LEAVE_RET('i', EINVAL); // Find last child, while we're at it, check for duplication for( child = parent->Data.FirstChild; child; prev = child, child = child->Next ) { if(strcmp(child->Name, Name) == 0) { LOG("Duplicate"); - LEAVE('i', 0); - return 0; + LEAVE('i', EEXIST); + return EEXIST; } } @@ -137,8 +137,8 @@ int Root_MkNod(tVFS_Node *Node, const char *Name, Uint Flags) parent->Node.Size ++; - LEAVE('i', 1); - return 1; + LEAVE('i', EOK); + return EOK; } /** diff --git a/KernelLand/Modules/USB/HID/keyboard.c b/KernelLand/Modules/USB/HID/keyboard.c index 380518d7..6a473c68 100644 --- a/KernelLand/Modules/USB/HID/keyboard.c +++ b/KernelLand/Modules/USB/HID/keyboard.c @@ -137,7 +137,7 @@ void HID_Kb_Report_Input(tUSBInterface *Dev, tHID_ReportGlobalState *Global, tHI info->Info = NULL; info->CollectionDepth = 1; info->bIsBoot = 1; // TODO: Detect non-boot keyboards and parse descriptor - Log_Warning("USB HID", "TODO: Handle non-boot keyboards!"); + Log_Warning("USB HID", "TODO: Detect and handle non-boot keyboards!"); info->Info = Keyboard_CreateInstance(0, "USBKeyboard"); } } -- 2.20.1