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
Usermode/AxWin3 - More WM IPC messages implemented
[tpg/acess2.git]
/
Kernel
/
vfs
/
dir.c
diff --git
a/Kernel/vfs/dir.c
b/Kernel/vfs/dir.c
index
22249ef
..
8cc3fa8
100644
(file)
--- a/
Kernel/vfs/dir.c
+++ b/
Kernel/vfs/dir.c
@@
-3,7
+3,7
@@
* - Directory Management Functions
*/
#define DEBUG 0
* - Directory Management Functions
*/
#define DEBUG 0
-#include <
common
.h>
+#include <
acess
.h>
#include <vfs.h>
#include <vfs_int.h>
#include <vfs.h>
#include <vfs_int.h>
@@
-11,8
+11,10
@@
extern tVFS_Mount *gRootMount;
// === PROTOTYPES ===
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 ===
/**
// === CODE ===
/**
@@
-20,7
+22,7
@@
extern tVFS_Mount *gRootMount;
* \brief Create a new node
* \param Path Path of directory to create
*/
* \brief Create a new node
* \param Path Path of directory to create
*/
-int VFS_MkDir(char *Path)
+int VFS_MkDir(c
onst c
har *Path)
{
return VFS_MkNod(Path, VFS_FFLAG_DIRECTORY);
}
{
return VFS_MkNod(Path, VFS_FFLAG_DIRECTORY);
}
@@
-31,28
+33,42
@@
int VFS_MkDir(char *Path)
* \param Path Path of new node
* \param Flags Flags to apply to the node
*/
* \param Path Path of new node
* \param Flags Flags to apply to the node
*/
-int VFS_MkNod(char *Path, Uint Flags)
+int VFS_MkNod(c
onst c
har *Path, Uint Flags)
{
char *absPath, *name;
{
char *absPath, *name;
- int pos=0, oldpos = 0;
+ int pos = 0, oldpos = 0;
+ int next = 0;
tVFS_Node *parent;
int ret;
ENTER("sPath xFlags", Path, Flags);
absPath = VFS_GetAbsPath(Path);
tVFS_Node *parent;
int ret;
ENTER("sPath xFlags", Path, Flags);
absPath = VFS_GetAbsPath(Path);
+ LOG("absPath = '%s'", absPath);
- while( (pos = strpos8(&absPath[pos+1], '/')) != -1 ) oldpos = pos;
+ while( (next = strpos(&absPath[pos+1], '/')) != -1 ) {
+ LOG("next = %i", next);
+ pos += next+1;
+ LOG("pos = %i", pos);
+ oldpos = pos;
+ }
absPath[oldpos] = '\0'; // Mutilate path
name = &absPath[oldpos+1];
absPath[oldpos] = '\0'; // Mutilate path
name = &absPath[oldpos+1];
+ LOG("absPath = '%s', name = '%s'", absPath, name);
+
// Check for root
if(absPath[0] == '\0')
// Check for root
if(absPath[0] == '\0')
- parent = VFS_ParsePath("/", NULL);
+ parent = VFS_ParsePath("/", NULL
, NULL
);
else
else
- parent = VFS_ParsePath(absPath, NULL);
+ parent = VFS_ParsePath(absPath, NULL, NULL);
+
+ LOG("parent = %p", parent);
- if(!parent) return -1; // Error Check
+ if(!parent) {
+ LEAVE('i', -1);
+ return -1; // Error Check
+ }
// Permissions Check
if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) {
// Permissions Check
if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) {
@@
-62,7
+78,7
@@
int VFS_MkNod(char *Path, Uint Flags)
return -1;
}
return -1;
}
- LOG("parent = %p
\n
", parent);
+ LOG("parent = %p", 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");
@@
-90,33
+106,39
@@
int VFS_MkNod(char *Path, Uint Flags)
}
/**
}
/**
- * \fn int VFS_Symlink(c
har *Name,
char *Link)
+ * \fn int VFS_Symlink(c
onst 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
*/
* \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(c
har *Name,
char *Link)
+int VFS_Symlink(c
onst char *Name, const
char *Link)
{
char *realLink;
int fp;
tVFS_Node *destNode;
{
char *realLink;
int fp;
tVFS_Node *destNode;
+ char *_link;
//ENTER("sName sLink", Name, Link);
// Get absolue path name
//ENTER("sName sLink", Name, Link);
// Get absolue path name
-
L
ink = VFS_GetAbsPath( Link );
- if(!
L
ink) {
-
Warning(
"Path '%s' is badly formed", Link);
+
_l
ink = VFS_GetAbsPath( Link );
+ if(!
_l
ink) {
+
Log_Warning("VFS",
"Path '%s' is badly formed", Link);
return -1;
}
return -1;
}
+ destNode = VFS_ParsePath( _link, &realLink, NULL );
+ #if 0
// Get true path and node
// 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) {
// 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;
}
return -1;
}
@@
-125,7
+147,7
@@
int VFS_Symlink(char *Name, char *Link)
// Make node
if( VFS_MkNod(Name, VFS_FFLAG_SYMLINK) != 0 ) {
// 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
}
return -2; // Make link node
}
UCC
git Repository :: git.ucc.asn.au