From: John Hodge Date: Sat, 14 Jul 2012 10:14:55 +0000 (+0800) Subject: Kernel/VFS - Fixed logic error in MkNod (rootfs and dir.c) X-Git-Tag: rel0.15~611^2~35 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=42fb98c5f353bf3e7cfbc202e2ace886b0c85874;p=tpg%2Facess2.git Kernel/VFS - Fixed logic error in MkNod (rootfs and dir.c) - Also did minor debugging changes to heap and USB keyboard --- 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"); } }