Multiple changes (Module Interopability, Timers, FDD Driver, VFS Bugs)
[tpg/acess2.git] / Kernel / vfs / fs / ext2.c
index 50be904..8ee26af 100644 (file)
@@ -88,7 +88,7 @@ tVFS_Node *Ext2_InitDevice(char *Device, char **Options)
        // Open Disk\r
        fd = VFS_Open(Device, VFS_OPENFLAG_READ|VFS_OPENFLAG_WRITE);            //Open Device\r
        if(fd == -1) {\r
-               Warning("[EXT2 ] Unable to open '%s'\n", Device);\r
+               Warning("[EXT2 ] Unable to open '%s'", Device);\r
                LEAVE('n');\r
                return NULL;\r
        }\r
@@ -98,7 +98,7 @@ tVFS_Node *Ext2_InitDevice(char *Device, char **Options)
        \r
        // Sanity Check Magic value\r
        if(sb.s_magic != 0xEF53) {\r
-               Warning("[EXT2 ] Volume '%s' is not an EXT2 volume\n", Device);\r
+               Warning("[EXT2 ] Volume '%s' is not an EXT2 volume", Device);\r
                VFS_Close(fd);\r
                LEAVE('n');\r
                return NULL;\r
@@ -111,7 +111,7 @@ tVFS_Node *Ext2_InitDevice(char *Device, char **Options)
        // Allocate Disk Information\r
        disk = malloc(sizeof(tExt2_Disk) + sizeof(tExt2_Group)*groupCount);\r
        if(!disk) {\r
-               Warning("[EXT2 ] Unable to allocate disk structure\n");\r
+               Warning("[EXT2 ] Unable to allocate disk structure");\r
                VFS_Close(fd);\r
                LEAVE('n');\r
                return NULL;\r
@@ -218,7 +218,7 @@ Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
        Offset = Offset / disk->BlockSize;\r
        base = Ext2_int_GetBlockAddr(disk, inode.i_block, block);\r
        if(base == 0) {\r
-               Warning("[EXT2 ] NULL Block Detected in INode 0x%llx\n", Node->Inode);\r
+               Warning("[EXT2 ] NULL Block Detected in INode 0x%llx", Node->Inode);\r
                LEAVE('i', 0);\r
                return 0;\r
        }\r
@@ -243,7 +243,7 @@ Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
        {\r
                base = Ext2_int_GetBlockAddr(disk, inode.i_block, block);\r
                if(base == 0) {\r
-                       Warning("[EXT2 ] NULL Block Detected in INode 0x%llx\n", Node->Inode);\r
+                       Warning("[EXT2 ] NULL Block Detected in INode 0x%llx", Node->Inode);\r
                        LEAVE('i', 0);\r
                        return 0;\r
                }\r
@@ -367,7 +367,7 @@ char *Ext2_ReadDir(tVFS_Node *Node, int Pos)
        Ext2_int_GetInode(Node, &inode);\r
        size = inode.i_size;\r
        \r
-       LOG("inode.i_block[0] = 0x%x\n", inode.i_block[0]);\r
+       LOG("inode.i_block[0] = 0x%x", inode.i_block[0]);\r
        \r
        // Find Entry\r
        // Get First Block\r
@@ -383,7 +383,7 @@ char *Ext2_ReadDir(tVFS_Node *Node, int Pos)
                if(ofs >= disk->BlockSize) {\r
                        block ++;\r
                        if( ofs > disk->BlockSize ) {\r
-                               Warning("[EXT2] Directory Entry %i of inode %i extends over a block boundary, ignoring\n",\r
+                               Warning("[EXT2] Directory Entry %i of inode %i extends over a block boundary, ignoring",\r
                                        entNum-1, Node->Inode);\r
                        }\r
                        ofs = 0;\r
@@ -391,13 +391,17 @@ char *Ext2_ReadDir(tVFS_Node *Node, int Pos)
                }\r
        }\r
        \r
-       if(size <= 0)   return NULL;\r
+       // Check for the end of the list\r
+       if(size <= 0) {\r
+               LEAVE('n');\r
+               return NULL;\r
+       }\r
        \r
        // Read Entry\r
        VFS_ReadAt( disk->FD, Base+ofs, sizeof(tExt2_DirEnt), &dirent );\r
-       //LOG("dirent.inode = %i\n", dirent.inode);\r
-       //LOG("dirent.rec_len = %i\n", dirent.rec_len);\r
-       //LOG("dirent.name_len = %i\n", dirent.name_len);\r
+       //LOG("dirent.inode = %i", dirent.inode);\r
+       //LOG("dirent.rec_len = %i", dirent.rec_len);\r
+       //LOG("dirent.name_len = %i", dirent.name_len);\r
        VFS_ReadAt( disk->FD, Base+ofs+sizeof(tExt2_DirEnt), dirent.name_len, namebuf );\r
        namebuf[ dirent.name_len ] = '\0';      // Cap off string\r
        \r
@@ -457,7 +461,7 @@ tVFS_Node *Ext2_FindDir(tVFS_Node *Node, char *Filename)
                if(ofs >= disk->BlockSize) {\r
                        block ++;\r
                        if( ofs > disk->BlockSize ) {\r
-                               Warning("[EXT2 ] Directory Entry %i of inode %i extends over a block boundary, ignoring\n",\r
+                               Warning("[EXT2 ] Directory Entry %i of inode %i extends over a block boundary, ignoring",\r
                                        entNum-1, Node->Inode);\r
                        }\r
                        ofs = 0;\r
@@ -573,7 +577,8 @@ int Ext2_int_ReadInode(tExt2_Disk *Disk, Uint InodeId, tExt2_Inode *Inode)
 {\r
         int    group, subId;\r
        \r
-       //LogF("Ext2_int_ReadInode: (Disk=%p, InodeId=%i, Inode=%p)\n", Disk, InodeId, Inode);\r
+       //LogF("Ext2_int_ReadInode: (Disk=%p, InodeId=%i, Inode=%p)", Disk, InodeId, Inode);\r
+       //ENTER("pDisk iInodeId pInode", Disk, InodeId, Inode);\r
        \r
        if(InodeId == 0)        return 0;\r
        \r
@@ -582,7 +587,7 @@ int Ext2_int_ReadInode(tExt2_Disk *Disk, Uint InodeId, tExt2_Inode *Inode)
        group = InodeId / Disk->SuperBlock.s_inodes_per_group;\r
        subId = InodeId % Disk->SuperBlock.s_inodes_per_group;\r
        \r
-       //LogF(" Ext2_int_ReadInode: group=%i, subId = %i\n", group, subId);\r
+       //LOG("group=%i, subId = %i", group, subId);\r
        \r
        // Read Inode\r
        VFS_ReadAt(Disk->FD,\r

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