X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fdir.c;h=22249ef681069a5c7315f9f658e139b5f40140ad;hb=867e5b9aa786835070c0857113937d44619558ad;hp=b4001dd1a3f51dde96147b22b5df0a0d9011a0e6;hpb=72fcc8d0873e91f713be3d23af32a4e83f40cdf5;p=tpg%2Facess2.git diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index b4001dd1..22249ef6 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -1,7 +1,11 @@ /* + * Acess2 VFS + * - Directory Management Functions */ -#include "vfs.h" -#include "vfs_int.h" +#define DEBUG 0 +#include +#include +#include // === IMPORTS === extern tVFS_Mount *gRootMount; @@ -34,7 +38,7 @@ int VFS_MkNod(char *Path, Uint Flags) tVFS_Node *parent; int ret; - Debug_Enter("VFS_MkNod", "sPath xFlags", Path, Flags); + ENTER("sPath xFlags", Path, Flags); absPath = VFS_GetAbsPath(Path); @@ -54,15 +58,15 @@ int VFS_MkNod(char *Path, Uint Flags) if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) { if(parent->Close) parent->Close( parent ); free(absPath); - Debug_Leave("VFS_MkNod", 'i', -1); + LEAVE('i', -1); return -1; } - Debug_Log("VFS_MkNod", "parent = %p\n", parent); + LOG("parent = %p\n", parent); if(parent->MkNod == NULL) { Warning("VFS_MkNod - Directory has no MkNod method"); - Debug_Leave("VFS_MkNod", 'i', -1); + LEAVE('i', -1); return -1; } @@ -76,9 +80,12 @@ int VFS_MkNod(char *Path, Uint Flags) if(parent->Close) parent->Close( parent ); // Error Check - if(ret == 0) return -1; + if(ret == 0) { + LEAVE('i', -1); + return -1; + } - Debug_Leave("VFS_MkNod", 'i', 0); + LEAVE('i', 0); return 0; } @@ -94,7 +101,7 @@ int VFS_Symlink(char *Name, char *Link) int fp; tVFS_Node *destNode; - //LogF("vfs_symlink: (name='%s', link='%s')\n", name, link); + //ENTER("sName sLink", Name, Link); // Get absolue path name Link = VFS_GetAbsPath( Link ); @@ -141,19 +148,36 @@ int VFS_ReadDir(int FD, char *Dest) tVFS_Handle *h = VFS_GetHandle(FD); char *tmp; - if(h) return -1; + //ENTER("ph pDest", h, Dest); - if(h->Node->ReadDir == NULL) return 0; + if(!h || h->Node->ReadDir == NULL) { + //LEAVE('i', 0); + return 0; + } - tmp = h->Node->ReadDir(h->Node, h->Position); + if(h->Node->Size != -1 && h->Position >= h->Node->Size) { + //LEAVE('i', 0); + return 0; + } - if(!tmp) return 0; + do { + tmp = h->Node->ReadDir(h->Node, h->Position); + if((Uint)tmp < (Uint)VFS_MAXSKIP) + h->Position += (Uint)tmp; + else + h->Position ++; + } while(tmp != NULL && (Uint)tmp < (Uint)VFS_MAXSKIP); - h->Position ++; + //LOG("tmp = '%s'", tmp); - strcpy(Dest, tmp); + if(!tmp) { + //LEAVE('i', 0); + return 0; + } - if(IsHeap(tmp)) free(tmp); + strcpy(Dest, tmp); + free(tmp); + //LEAVE('i', 1); return 1; }