Kernel/VFS - Fixed logic error in MkNod (rootfs and dir.c)
authorJohn Hodge <[email protected]>
Sat, 14 Jul 2012 10:14:55 +0000 (18:14 +0800)
committerJohn Hodge <[email protected]>
Sat, 14 Jul 2012 10:14:55 +0000 (18:14 +0800)
- Also did minor debugging changes to heap and USB keyboard

KernelLand/Kernel/heap.c
KernelLand/Kernel/vfs/dir.c
KernelLand/Kernel/vfs/fs/root.c
KernelLand/Modules/USB/HID/keyboard.c

index cb94d87..9e29145 100644 (file)
@@ -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;
        }
index fcf361e..26f6f0f 100644 (file)
@@ -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;
 }
 
 /**
index 4416750..6c45f40 100644 (file)
@@ -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;
 }
 
 /**
index 380518d..6a473c6 100644 (file)
@@ -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");
        }
 }

UCC git Repository :: git.ucc.asn.au