X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fdir.c;h=8cc3fa84f7eac7e7636c073b26ec48b005981085;hb=e7dd0e094f0c23bb20ddb0025f41d1c0c28f5ab2;hp=8e8234ca72849de7c48863f8f3ecd83d1e3303ec;hpb=3064ee4a12abf17bc88eea5f1b2bb5ad419889f6;p=tpg%2Facess2.git diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index 8e8234ca..8cc3fa84 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -2,7 +2,7 @@ * Acess2 VFS * - Directory Management Functions */ -#define DEBUG 1 +#define DEBUG 0 #include #include #include @@ -11,8 +11,10 @@ extern tVFS_Mount *gRootMount; // === PROTOTYPES === - int VFS_MkDir(char *Path); - int VFS_MkNod(char *Path, Uint Flags); +#if 0 + int VFS_MkDir(const char *Path); +#endif + int VFS_MkNod(const char *Path, Uint Flags); // === CODE === /** @@ -20,7 +22,7 @@ extern tVFS_Mount *gRootMount; * \brief Create a new node * \param Path Path of directory to create */ -int VFS_MkDir(char *Path) +int VFS_MkDir(const char *Path) { return VFS_MkNod(Path, VFS_FFLAG_DIRECTORY); } @@ -31,7 +33,7 @@ int VFS_MkDir(char *Path) * \param Path Path of new node * \param Flags Flags to apply to the node */ -int VFS_MkNod(char *Path, Uint Flags) +int VFS_MkNod(const char *Path, Uint Flags) { char *absPath, *name; int pos = 0, oldpos = 0; @@ -57,9 +59,9 @@ int VFS_MkNod(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); @@ -104,33 +106,39 @@ int VFS_MkNod(char *Path, Uint Flags) } /** - * \fn int VFS_Symlink(char *Name, char *Link) + * \fn int VFS_Symlink(const char *Name, const char *Link) * \brief Creates a symlink called \a Name to \a Link * \param Name Name of symbolic link * \param Link Destination of symbolic link */ -int VFS_Symlink(char *Name, char *Link) +int VFS_Symlink(const char *Name, const char *Link) { char *realLink; int fp; tVFS_Node *destNode; + char *_link; //ENTER("sName sLink", Name, Link); // Get absolue path name - Link = VFS_GetAbsPath( Link ); - if(!Link) { - Warning("Path '%s' is badly formed", Link); + _link = VFS_GetAbsPath( Link ); + if(!_link) { + Log_Warning("VFS", "Path '%s' is badly formed", Link); return -1; } + destNode = VFS_ParsePath( _link, &realLink, NULL ); + #if 0 // Get true path and node - destNode = VFS_ParsePath( Link, &realLink ); - free(Link); + free(_link); + _link = NULL; + #else + realLink = _link; + #endif // Check if destination exists if(!destNode) { - Warning("File '%s' does not exist, symlink not created", Link); + Log_Warning("VFS", "File '%s' does not exist, symlink not created", Link); return -1; } @@ -139,7 +147,7 @@ int VFS_Symlink(char *Name, char *Link) // 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); return -2; // Make link node }