X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fvfs%2Ffs%2Froot.c;h=00829edff8f20e6828f0df598f7a06dfc51c2fd7;hb=65e8f70ac79804f4c7519c4c0237642984e4c0b0;hp=9fa1732b9391f054dc84ba20b57fb055590cdb59;hpb=48743e39650eb1ef988380e9d95f27fd40d3a9ce;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/vfs/fs/root.c b/KernelLand/Kernel/vfs/fs/root.c index 9fa1732b..00829edf 100644 --- a/KernelLand/Kernel/vfs/fs/root.c +++ b/KernelLand/Kernel/vfs/fs/root.c @@ -16,8 +16,8 @@ tVFS_Node *Root_InitDevice(const char *Device, const char **Options); int Root_MkNod(tVFS_Node *Node, const char *Name, Uint Flags); tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name); char *Root_ReadDir(tVFS_Node *Node, int Pos); -Uint64 Root_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 Root_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); tRamFS_File *Root_int_AllocFile(void); // === GLOBALS === @@ -142,14 +142,20 @@ tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name) tRamFS_File *parent = Node->ImplPtr; tRamFS_File *child = parent->Data.FirstChild; + ENTER("pNode sName", Node, Name); //Log("Root_FindDir: (Node=%p, Name='%s')", Node, Name); for(;child;child = child->Next) { //Log(" Root_FindDir: strcmp('%s', '%s')", child->Node.Name, Name); - if(strcmp(child->Name, Name) == 0) return &child->Node; + LOG("child->Name = '%s'", child->Name); + if(strcmp(child->Name, Name) == 0) { + LEAVE('p', &child->Node); + return &child->Node; + } } + LEAVE('n'); return NULL; } @@ -170,39 +176,32 @@ char *Root_ReadDir(tVFS_Node *Node, int Pos) } /** - * \fn Uint64 Root_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Read from a file in the root directory */ -Uint64 Root_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tRamFS_File *file = Node->ImplPtr; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); - - if(Offset > Node->Size) { - LEAVE('i', 0); - return 0; - } - if(Length > Node->Size) Length = Node->Size; + if(Offset > Node->Size) return 0; + + if(Length > Node->Size) + Length = Node->Size; if(Offset+Length > Node->Size) Length = Node->Size - Offset; memcpy(Buffer, file->Data.Bytes+Offset, Length); - LOG("Buffer = '%.*s'", (int)Length, Buffer); - - LEAVE('i', Length); + return Length; } /** - * \fn Uint64 Root_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Write to a file in the root directory */ -Uint64 Root_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { tRamFS_File *file = Node->ImplPtr; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); + ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer); if(Offset > Node->Size) { LEAVE('i', -1);