git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Started adding sanity checks to syscalls. Added SYS_CHDIR and helpers. Used SYS_CHDIR...
[tpg/acess2.git]
/
Kernel
/
vfs
/
dir.c
diff --git
a/Kernel/vfs/dir.c
b/Kernel/vfs/dir.c
index
39cd3ec
..
22249ef
100644
(file)
--- 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 <common.h>
+#include <vfs.h>
+#include <vfs_int.h>
// === IMPORTS ===
extern tVFS_Mount *gRootMount;
// === IMPORTS ===
extern tVFS_Mount *gRootMount;
@@
-34,7
+38,7
@@
int VFS_MkNod(char *Path, Uint Flags)
tVFS_Node *parent;
int ret;
tVFS_Node *parent;
int ret;
-
Debug_Enter("VFS_MkNod",
"sPath xFlags", Path, Flags);
+
ENTER(
"sPath xFlags", Path, Flags);
absPath = VFS_GetAbsPath(Path);
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);
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;
}
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");
if(parent->MkNod == NULL) {
Warning("VFS_MkNod - Directory has no MkNod method");
-
Debug_Leave("VFS_MkNod",
'i', -1);
+
LEAVE(
'i', -1);
return -1;
}
return -1;
}
@@
-76,9
+80,12
@@
int VFS_MkNod(char *Path, Uint Flags)
if(parent->Close) parent->Close( parent );
// Error Check
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;
}
return 0;
}
@@
-94,7
+101,7
@@
int VFS_Symlink(char *Name, char *Link)
int fp;
tVFS_Node *destNode;
int fp;
tVFS_Node *destNode;
- //
LogF("vfs_symlink: (name='%s', link='%s')\n", name, l
ink);
+ //
ENTER("sName sLink", Name, L
ink);
// Get absolue path name
Link = VFS_GetAbsPath( Link );
// Get absolue path name
Link = VFS_GetAbsPath( Link );
@@
-132,7
+139,6
@@
int VFS_Symlink(char *Name, char *Link)
return 1;
}
return 1;
}
-#define READDIR_FIXUP(ptr) (void*)( (Uint)(ptr) & ~1 )
/**
* \fn int VFS_ReadDir(int FD, char *Dest)
* \brief Read from a directory
/**
* \fn int VFS_ReadDir(int FD, char *Dest)
* \brief Read from a directory
@@
-142,15
+148,15
@@
int VFS_ReadDir(int FD, char *Dest)
tVFS_Handle *h = VFS_GetHandle(FD);
char *tmp;
tVFS_Handle *h = VFS_GetHandle(FD);
char *tmp;
- ENTER("ph pDest", h, Dest);
+
//
ENTER("ph pDest", h, Dest);
if(!h || h->Node->ReadDir == NULL) {
if(!h || h->Node->ReadDir == NULL) {
- LEAVE('i', 0);
+
//
LEAVE('i', 0);
return 0;
}
if(h->Node->Size != -1 && h->Position >= h->Node->Size) {
return 0;
}
if(h->Node->Size != -1 && h->Position >= h->Node->Size) {
- LEAVE('i', 0);
+
//
LEAVE('i', 0);
return 0;
}
return 0;
}
@@
-162,18
+168,16
@@
int VFS_ReadDir(int FD, char *Dest)
h->Position ++;
} while(tmp != NULL && (Uint)tmp < (Uint)VFS_MAXSKIP);
h->Position ++;
} while(tmp != NULL && (Uint)tmp < (Uint)VFS_MAXSKIP);
-
LOG("tmp = '%s'", READDIR_FIXUP(tmp)
);
+
//LOG("tmp = '%s'", tmp
);
if(!tmp) {
if(!tmp) {
- LEAVE('i', 0);
+
//
LEAVE('i', 0);
return 0;
}
return 0;
}
- strcpy(Dest, READDIR_FIXUP(tmp));
-
- if((Uint)tmp & 1)
- free(READDIR_FIXUP(tmp));
+ strcpy(Dest, tmp);
+ free(tmp);
- LEAVE('i', 1);
+
//
LEAVE('i', 1);
return 1;
}
return 1;
}
UCC
git Repository :: git.ucc.asn.au