*/
int VFS_MkNod(const char *Path, Uint Flags)
{
+ tVFS_Mount *mountpt;
char *absPath, *name;
int pos = 0, oldpos = 0;
int next = 0;
tVFS_Node *parent;
- int ret;
+ tVFS_Node *ret;
ENTER("sPath xFlags", Path, Flags);
// Check for root
if(absPath[0] == '\0')
- parent = VFS_ParsePath("/", NULL, NULL);
+ parent = VFS_ParsePath("/", NULL, &mountpt);
else
- parent = VFS_ParsePath(absPath, NULL, NULL);
+ parent = VFS_ParsePath(absPath, NULL, &mountpt);
LOG("parent = %p", parent);
LEAVE('i', -1);
return -1; // Error Check
}
-
+
// Permissions Check
if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) {
_CloseNode(parent);
+ mountpt->OpenHandleCount --;
free(absPath);
LEAVE('i', -1);
return -1;
LOG("parent = %p", parent);
if(!parent->Type || !parent->Type->MkNod) {
- Warning("VFS_MkNod - Directory has no MkNod method");
+ Log_Warning("VFS", "VFS_MkNod - Directory has no MkNod method");
+ mountpt->OpenHandleCount --;
LEAVE('i', -1);
return -1;
}
// Create node
ret = parent->Type->MkNod(parent, name, Flags);
+ _CloseNode(ret);
// Free allocated string
free(absPath);
// Free Parent
+ mountpt->OpenHandleCount --;
_CloseNode(parent);
-
- // Error Check
- if(ret != 0) {
- LEAVE('i', -1);
- return -1;
- }
-
- LEAVE('i', 0);
- return 0;
+
+ // Return whatever the driver said
+ LEAVE('i', ret==NULL);
+ return ret==NULL;
}
/**
int VFS_ReadDir(int FD, char *Dest)
{
tVFS_Handle *h = VFS_GetHandle(FD);
- char *tmp;
+ int rv;
//ENTER("ph pDest", h, Dest);
return 0;
}
- if(h->Node->Size != -1 && h->Position >= h->Node->Size) {
+ if(h->Node->Size != (Uint64)-1 && h->Position >= h->Node->Size) {
//LEAVE('i', 0);
return 0;
}
do {
- tmp = h->Node->Type->ReadDir(h->Node, h->Position);
- if((Uint)tmp < (Uint)VFS_MAXSKIP)
- h->Position += (Uint)tmp;
+ rv = h->Node->Type->ReadDir(h->Node, h->Position, Dest);
+ if(rv > 0)
+ h->Position += rv;
else
h->Position ++;
- } while(tmp != NULL && (Uint)tmp < (Uint)VFS_MAXSKIP);
+ } while(rv > 0);
- //LOG("tmp = '%s'", tmp);
-
- if(!tmp) {
+ if(rv < 0) {
//LEAVE('i', 0);
return 0;
}
- strcpy(Dest, tmp);
- free(tmp);
-
//LEAVE('i', 1);
return 1;
}