X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fdir.c;h=aee7a6037f5b530b4b53a7680409ff0ffb34bdd6;hb=cbe0cc999c61fff862054bf428b7163e5458f2af;hp=0fa213d18c05676f45c1a4c6ff53190148878d55;hpb=4e949acb1c98bc071af2d5d9038b4a3e703bf33d;p=tpg%2Facess2.git diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index 0fa213d1..aee7a603 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -11,8 +11,11 @@ extern tVFS_Mount *gRootMount; // === PROTOTYPES === +#if 0 int VFS_MkDir(const char *Path); +#endif int VFS_MkNod(const char *Path, Uint Flags); +// int VFS_Symlink(const char *Name, const char *Link); // === CODE === /** @@ -57,9 +60,9 @@ int VFS_MkNod(const char *Path, Uint Flags) // Check for root if(absPath[0] == '\0') - parent = VFS_ParsePath("/", NULL); + parent = VFS_ParsePath("/", NULL, NULL); else - parent = VFS_ParsePath(absPath, NULL); + parent = VFS_ParsePath(absPath, NULL, NULL); LOG("parent = %p", parent); @@ -70,7 +73,7 @@ int VFS_MkNod(const char *Path, Uint Flags) // Permissions Check if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) { - if(parent->Close) parent->Close( parent ); + _CloseNode(parent); free(absPath); LEAVE('i', -1); return -1; @@ -78,20 +81,20 @@ int VFS_MkNod(const char *Path, Uint Flags) LOG("parent = %p", parent); - if(parent->MkNod == NULL) { + if(!parent->Type || !parent->Type->MkNod) { Warning("VFS_MkNod - Directory has no MkNod method"); LEAVE('i', -1); return -1; } // Create node - ret = parent->MkNod(parent, name, Flags); + ret = parent->Type->MkNod(parent, name, Flags); // Free allocated string free(absPath); // Free Parent - if(parent->Close) parent->Close( parent ); + _CloseNode(parent); // Error Check if(ret == 0) { @@ -113,35 +116,24 @@ int VFS_Symlink(const char *Name, const char *Link) { char *realLink; int fp; - tVFS_Node *destNode; - char *_link; - //ENTER("sName sLink", Name, Link); + ENTER("sName sLink", Name, Link); // Get absolue path name - _link = VFS_GetAbsPath( Link ); - if(!_link) { - Warning("Path '%s' is badly formed", Link); - return -1; - } - - // Get true path and node - destNode = VFS_ParsePath( _link, &realLink ); - free(_link); - _link = NULL; - - // Check if destination exists - if(!destNode) { - Warning("File '%s' does not exist, symlink not created", Link); + realLink = VFS_GetAbsPath( Link ); + if(!realLink) { + Log_Warning("VFS", "Path '%s' is badly formed", Link); + LEAVE('i', -1); return -1; } - - // Derefence the destination - if(destNode->Close) destNode->Close(destNode); - + + LOG("realLink = '%s'", realLink); + // Make node if( VFS_MkNod(Name, VFS_FFLAG_SYMLINK) != 0 ) { - Warning("Unable to create link node '%s'", Name); + Log_Warning("VFS", "Unable to create link node '%s'", Name); + free(realLink); + LEAVE('i', -2); return -2; // Make link node } @@ -152,6 +144,7 @@ int VFS_Symlink(const char *Name, const char *Link) free(realLink); + LEAVE('i', 1); return 1; } @@ -166,7 +159,7 @@ int VFS_ReadDir(int FD, char *Dest) //ENTER("ph pDest", h, Dest); - if(!h || h->Node->ReadDir == NULL) { + if(!h || !h->Node->Type || !h->Node->Type->ReadDir) { //LEAVE('i', 0); return 0; } @@ -177,7 +170,7 @@ int VFS_ReadDir(int FD, char *Dest) } do { - tmp = h->Node->ReadDir(h->Node, h->Position); + tmp = h->Node->Type->ReadDir(h->Node, h->Position); if((Uint)tmp < (Uint)VFS_MAXSKIP) h->Position += (Uint)tmp; else