/*
- * Acess OS
- * Ext2 Driver Version 1
+ * Acess2 Ext2 Driver
+ * - By John Hodge (thePowersGang)
+ *
+ * dir.c
+ * - Directory Handling
*/
-/**
- * \file dir.c
- * \brief Second Extended Filesystem Driver
- * \todo Implement file full write support
- */
-#define DEBUG 1
+#define DEBUG 0
#define VERBOSE 0
#include "ext2_common.h"
while(size > 0)
{
VFS_ReadAt( disk->FD, Base+ofs, sizeof(tExt2_DirEnt), &dirent);
+ // TODO: Possible overrun if name_len == 255?
dirent.name[ dirent.name_len ] = '\0'; // Cap off string
// If it matches, create a node and return it
if(dirent.name_len == filenameLen && strcmp(dirent.name, Filename) == 0)
/*\r
- * Acess OS\r
- * Ext2 Driver Version 1\r
+ * Acess2 Ext2 Driver\r
+ * - By John Hodge (thePowersGang)\r
+ *\r
+ * ext2.c\r
+ * - Driver core\r
*/\r
-/**\r
- * \file fs/ext2.c\r
- * \brief Second Extended Filesystem Driver\r
- * \todo Implement file full write support\r
- */\r
-#define DEBUG 1\r
-#define VERBOSE 0\r
+#define DEBUG 0\r
+#define VERSION VER2(0,90)\r
#include "ext2_common.h"\r
#include <modules.h>\r
\r
\r
// === PROTOTYPES ===\r
int Ext2_Install(char **Arguments);\r
-// Interface Functions\r
+void Ext2_Cleanup(void);\r
+// - Interface Functions\r
tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options);\r
void Ext2_Unmount(tVFS_Node *Node);\r
void Ext2_CloseFile(tVFS_Node *Node);\r
-// Internal Helpers\r
+// - Internal Helpers\r
int Ext2_int_GetInode(tVFS_Node *Node, tExt2_Inode *Inode);\r
Uint64 Ext2_int_GetBlockAddr(tExt2_Disk *Disk, Uint32 *Blocks, int BlockNum);\r
Uint32 Ext2_int_AllocateInode(tExt2_Disk *Disk, Uint32 Parent);\r
void Ext2_int_UpdateSuperblock(tExt2_Disk *Disk);\r
\r
// === SEMI-GLOBALS ===\r
-MODULE_DEFINE(0, 0x5B /*v0.90*/, FS_Ext2, Ext2_Install, NULL);\r
+MODULE_DEFINE(0, VERSION, FS_Ext2, Ext2_Install, Ext2_Cleanup);\r
tExt2_Disk gExt2_disks[6];\r
int giExt2_count = 0;\r
tVFS_Driver gExt2_FSInfo = {\r
return MODULE_ERR_OK;\r
}\r
\r
+/**\r
+ * \brief Clean up driver state before unload\r
+ */\r
+void Ext2_Cleanup(void)\r
+{\r
+ \r
+}\r
+\r
/**\r
\brief Initializes a device to be read by by the driver\r
\param Device String - Device to read from\r
disk->CacheID = Inode_GetHandle();\r
\r
// Get Block Size\r
- LOG("s_log_block_size = 0x%x", sb.s_log_block_size);\r
disk->BlockSize = 1024 << sb.s_log_block_size;\r
+ LOG("Disk->BlockSie = 0x%x (1024 << %i)", disk->BlockSize, sb.s_log_block_size);\r
\r
// Read Group Information\r
+ LOG("sb,s_first_data_block = %x", sb.s_first_data_block);\r
VFS_ReadAt(\r
disk->FD,\r
sb.s_first_data_block * disk->BlockSize + 1024,\r
disk->Groups\r
);\r
\r
- #if VERBOSE\r
LOG("Block Group 0");\r
LOG(".bg_block_bitmap = 0x%x", disk->Groups[0].bg_block_bitmap);\r
LOG(".bg_inode_bitmap = 0x%x", disk->Groups[0].bg_inode_bitmap);\r
LOG(".bg_block_bitmap = 0x%x", disk->Groups[1].bg_block_bitmap);\r
LOG(".bg_inode_bitmap = 0x%x", disk->Groups[1].bg_inode_bitmap);\r
LOG(".bg_inode_table = 0x%x", disk->Groups[1].bg_inode_table);\r
- #endif\r
\r
// Get root Inode\r
Ext2_int_ReadInode(disk, 2, &inode);\r