X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FFilesystems%2FExt2%2Fdir.c;h=1832ff976da321880632960f80f258303a559227;hb=3c496a30a8c22105fcf21089dce53809e5201205;hp=0ab3ed39b9fe3ad37c674e430af3330200f65065;hpb=923a9dc473851ec2bb1c94021bbf139724e7e8a5;p=tpg%2Facess2.git diff --git a/Modules/Filesystems/Ext2/dir.c b/Modules/Filesystems/Ext2/dir.c index 0ab3ed39..1832ff97 100644 --- a/Modules/Filesystems/Ext2/dir.c +++ b/Modules/Filesystems/Ext2/dir.c @@ -13,16 +13,17 @@ // === PROTOTYPES === -char *Ext2_ReadDir(tVFS_Node *Node, int Pos); +char *Ext2_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *Ext2_FindDir(tVFS_Node *Node, char *FileName); - int Ext2_MkNod(tVFS_Node *Node, char *Name, Uint Flags); + int Ext2_MkNod(tVFS_Node *Node, char *Name, Uint Flags); tVFS_Node *Ext2_int_CreateNode(tExt2_Disk *Disk, Uint InodeId, char *Name); // === CODE === /** - \fn char *Ext2_ReadDir(tVFS_Node *Node, int Pos) - \brief Reads a directory entry -*/ + * \brief Reads a directory entry + * \param Node Directory node + * \param Pos Position of desired element + */ char *Ext2_ReadDir(tVFS_Node *Node, int Pos) { tExt2_Inode inode; @@ -47,6 +48,7 @@ char *Ext2_ReadDir(tVFS_Node *Node, int Pos) // Get First Block // - Do this ourselves as it is a simple operation Base = inode.i_block[0] * disk->BlockSize; + // Scan directory while(Pos -- && size > 0) { VFS_ReadAt( disk->FD, Base+ofs, sizeof(tExt2_DirEnt), &dirent); @@ -57,7 +59,7 @@ char *Ext2_ReadDir(tVFS_Node *Node, int Pos) if(ofs >= disk->BlockSize) { block ++; if( ofs > disk->BlockSize ) { - Warning("[EXT2] Directory Entry %i of inode %i extends over a block boundary, ignoring", + Log_Warning("EXT2", "Directory Entry %i of inode %i extends over a block boundary, ignoring", entNum-1, Node->Inode); } ofs = 0; @@ -93,12 +95,11 @@ char *Ext2_ReadDir(tVFS_Node *Node, int Pos) } /** - \fn tVFS_Node *Ext2_FindDir(tVFS_Node *node, char *filename) - \brief Gets information about a file - \param node vfs node - Parent Node - \param filename String - Name of file - \return VFS Node of file -*/ + * \brief Gets information about a file + * \param Node Parent Node + * \param Filename Name of wanted file + * \return VFS Node of file + */ tVFS_Node *Ext2_FindDir(tVFS_Node *Node, char *Filename) { tExt2_Disk *disk = Node->ImplPtr; @@ -135,7 +136,7 @@ tVFS_Node *Ext2_FindDir(tVFS_Node *Node, char *Filename) if(ofs >= disk->BlockSize) { block ++; if( ofs > disk->BlockSize ) { - Warning("[EXT2 ] Directory Entry %i of inode %i extends over a block boundary, ignoring", + Log_Warning("EXT2", "Directory Entry %i of inode %i extends over a block boundary, ignoring", entNum-1, Node->Inode); } ofs = 0; @@ -152,7 +153,22 @@ tVFS_Node *Ext2_FindDir(tVFS_Node *Node, char *Filename) */ int Ext2_MkNod(tVFS_Node *Parent, char *Name, Uint Flags) { - return 0; + tVFS_Node *child; + + child = Ext2_int_AllocateNode(Parent, Flags); + return Ext2_Link(Parent, child, Name); +} + +/** + * \brief Links an existing node to a new name + * \param Parent Parent (directory) node + * \param Node Node to link + * \param Name New name for the node + * \return Boolean Failure - See ::tVFS_Node.Link for info + */ +int Ext2_Link(tVFS_Node *Parent, tVFS_Node *Node, char *Name) +{ + return 1; } // ---- INTERNAL FUNCTIONS ---- @@ -220,7 +236,7 @@ tVFS_Node *Ext2_int_CreateNode(tExt2_Disk *Disk, Uint InodeID, char *Name) //if(Name[0] == '.') retNode.Flags |= VFS_FFLAG_HIDDEN; // Set Timestamps - retNode.ATime = now(); + retNode.ATime = inode.i_atime * 1000; retNode.MTime = inode.i_mtime * 1000; retNode.CTime = inode.i_ctime * 1000;