* Device Filesystem (DevFS)
* - vfs/fs/devfs.c
*/
+#define DEBUG 0
#include <acess.h>
#include <vfs.h>
#include <fs_devfs.h>
{
int ret = 0;
tDevFS_Driver *dev;
+
+ ENTER("pDevice", Device);
+ LOG("Device->Name = '%s'", Device->Name);
SHORTLOCK( &glDevFS_ListLock );
else
Log_Warning("DevFS", "Device %p attempted to register '%s' which was owned by %p",
Device, dev->Name, dev);
- ret = 0; // Error
+ ret = -1; // Error
}
else {
Device->Next = gDevFS_Drivers;
}
SHORTREL( &glDevFS_ListLock );
+ LEAVE('i', ret);
return ret;
}
{
tDevFS_Driver *dev;
- //ENTER("pNode sName", Node, Name);
+ ENTER("pNode sName", Node, Name);
for(dev = gDevFS_Drivers;
dev;
)
{
//LOG("dev = %p", dev);
- //LOG("dev->Name = '%s'", dev->Name);
+ LOG("dev->Name = '%s'", dev->Name);
if(strcmp(dev->Name, Name) == 0) {
- //LEAVE('p', &dev->RootNode);
+ LEAVE('p', &dev->RootNode);
return &dev->RootNode;
}
}
- //LEAVE('n');
+ LEAVE('n');
return NULL;
}
tRamFS_File *parent = Node->ImplPtr;
tRamFS_File *child = parent->Data.FirstChild;
+ ENTER("pNode sName", Node, Name);
//Log("Root_FindDir: (Node=%p, Name='%s')", Node, Name);
for(;child;child = child->Next)
{
//Log(" Root_FindDir: strcmp('%s', '%s')", child->Node.Name, Name);
- if(strcmp(child->Name, Name) == 0) return &child->Node;
+ LOG("child->Name = '%s'", child->Name);
+ if(strcmp(child->Name, Name) == 0) {
+ LEAVE('p', &child->Node);
+ return &child->Node;
+ }
}
+ LEAVE('n');
return NULL;
}
if( chroot == NULL )
chroot = "";
chrootLen = strlen(chroot);
+ // Trim trailing slash off chroot
+ if( chrootLen && chroot[chrootLen - 1] == '/' )
+ chrootLen -= 1;
// Check if the path is already absolute
if(Path[0] == '/') {
// Check permissions on root of filesystem
if( !VFS_CheckACL(curNode, VFS_PERM_EXECUTE) ) {
- //Log("Permissions fail on '%s'", Path);
+ LOG("Permissions failure on '%s'", Path);
goto _error;
}
// Check if the node has a FindDir method
if( !curNode->Type->FindDir )
{
- //Log("FindDir fail on '%s'", Path);
+ LOG("Finddir failure on '%s'", Path);
goto _error;
}
LOG("FindDir{=%p}(%p, '%s')", curNode->Type->FindDir, curNode, pathEle);