else
{
// Sanity check the paths
- if(!Syscall_ValidString((char*)Regs->Arg1)
- || !Syscall_ValidString((char*)Regs->Arg2)
- || (Regs->Arg3 && !Syscall_ValidString((char*)Regs->Arg3))
- || !Syscall_ValidString((char*)Regs->Arg4) ) {
- err = -EINVAL;
- ret = -1;
- break;
- }
+ CHECK_STR_NONULL((char*)Regs->Arg1);
+ CHECK_STR_NONULL((char*)Regs->Arg2);
+ CHECK_STR_NULLOK((char*)Regs->Arg3);
+ CHECK_STR_NONULL((char*)Regs->Arg4);
ret = VFS_Mount(
(char*)Regs->Arg1, // Device
(char*)Regs->Arg2, // Mount point
0 // User handles
);
break;
+
+
+ // Create a directory
+ case SYS_MKDIR:
+ CHECK_STR_NONULL( (char*)Regs->Arg1 );
+ ret = VFS_MkDir( (char*)Regs->Arg1 );
+ break;
+ case SYS_UNLINK:
+ Log_Error("Syscalls", "TODO: Impliment SYS_UNLINK");
+ // Fall
// -- Debug
//#if DEBUG_BUILD
case SYS_DEBUG:
return ret==NULL;
_error:
- _CloseNode(parent);
- ASSERT(mountpt->OpenHandleCount>0);
- mountpt->OpenHandleCount --;
+ if( parent ) {
+ _CloseNode(parent);
+ ASSERT(mountpt->OpenHandleCount>0);
+ mountpt->OpenHandleCount --;
+ }
free(absPath);
LEAVE('i', -1);
return -1;
SYSCALL3(_SysIOCtl, SYS_IOCTL) // int, int, void*
SYSCALL4(_SysMount, SYS_MOUNT) // char*, char*, char*, char*
SYSCALL6(_SysSelect, SYS_SELECT) // int, fd_set*, fd_set*, fd_set*, tTime*, uint32_t
+
+SYSCALL1(_SysMkDir, SYS_MKDIR) // const char*
SYSCALL1(_SysUnlink, SYS_UNLINK) // const char*
extern int _SysMount(const char *Device, const char *Directory, const char *Type, const char *Options);
extern int _SysSelect(int nfds, fd_set *read, fd_set *write, fd_set *err, int64_t *timeout, unsigned int extraevents);
//#define select(nfs, rdfds, wrfds, erfds, timeout) _SysSelect(nfs, rdfds, wrfds, erfds, timeout, 0)
+extern int _SysMkDir(const char *dirname);
extern int _SysUnlink(const char *pathname);
// --- IPC ---