X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fopen.c;h=5d1d9fa7cd114af74644ef1e1ccbd50b2a955894;hb=4d498b090274b87befa5652589e0aa54b2b6fe0a;hp=9aeca95b92220767ccc28f14286591fa3abe8de0;hpb=4e949acb1c98bc071af2d5d9038b4a3e703bf33d;p=tpg%2Facess2.git diff --git a/Kernel/vfs/open.c b/Kernel/vfs/open.c index 9aeca95b..5d1d9fa7 100644 --- a/Kernel/vfs/open.c +++ b/Kernel/vfs/open.c @@ -15,8 +15,6 @@ // === IMPORTS === extern tVFS_Node gVFS_MemRoot; extern tVFS_Mount *gVFS_RootMount; - -extern tVFS_Handle *VFS_GetHandle(int FD); extern int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode); // === CODE === @@ -32,9 +30,9 @@ char *VFS_GetAbsPath(const char *Path) char *tmpStr; int iPos = 0; int iPos2 = 0; - char *chroot = CFGPTR(CFG_VFS_CHROOT); + const char *chroot = CFGPTR(CFG_VFS_CHROOT); int chrootLen; - char *cwd = CFGPTR(CFG_VFS_CWD); + const char *cwd = CFGPTR(CFG_VFS_CWD); int cwdLen; ENTER("sPath", Path); @@ -43,7 +41,7 @@ char *VFS_GetAbsPath(const char *Path) if(Path[0] == '$') { ret = malloc(strlen(Path)+1); if(!ret) { - Warning("VFS_GetAbsPath - malloc() returned NULL"); + Log_Warning("VFS", "VFS_GetAbsPath: malloc() returned NULL"); return NULL; } strcpy(ret, Path); @@ -63,7 +61,7 @@ char *VFS_GetAbsPath(const char *Path) if(Path[0] == '/') { ret = malloc(pathLen + 1); if(!ret) { - Warning("VFS_GetAbsPath - malloc() returned NULL"); + Log_Warning("VFS", "VFS_GetAbsPath: malloc() returned NULL"); return NULL; } strcpy(ret, Path); @@ -80,7 +78,7 @@ char *VFS_GetAbsPath(const char *Path) strcpy(ret, cwd); ret[cwdLen] = '/'; strcpy(&ret[cwdLen+1], Path); - //Log("ret = '%s'\n", ret); + //Log("ret = '%s'", ret); } // Parse Path @@ -510,7 +508,7 @@ int VFS_Open(const char *Path, Uint Mode) } i = VFS_AllocHandle( !!(Mode & VFS_OPENFLAG_USER), node, Mode ); - if( i > 0 ) { + if( i >= 0 ) { LEAVE('x', i); return i; } @@ -570,7 +568,7 @@ int VFS_OpenChild(Uint *Errno, int FD, const char *Name, Uint Mode) } i = VFS_AllocHandle( !!(Mode & VFS_OPENFLAG_USER), node, Mode ); - if( i > 0 ) { + if( i >= 0 ) { LEAVE('x', i); return i; } @@ -592,7 +590,7 @@ void VFS_Close(int FD) // Get handle h = VFS_GetHandle(FD); if(h == NULL) { - Log_Warning("VFS", "Invalid file handle passed to VFS_Close, 0x%x\n", FD); + Log_Warning("VFS", "Invalid file handle passed to VFS_Close, 0x%x", FD); return; } @@ -613,7 +611,7 @@ void VFS_Close(int FD) /** * \brief Change current working directory */ -int VFS_ChDir(char *Dest) +int VFS_ChDir(const char *Dest) { char *buf; int fd; @@ -659,7 +657,7 @@ int VFS_ChDir(char *Dest) * \fn int VFS_ChRoot(char *New) * \brief Change current root directory */ -int VFS_ChRoot(char *New) +int VFS_ChRoot(const char *New) { char *buf; int fd;