From: John Hodge Date: Tue, 22 Sep 2009 02:22:59 +0000 (+0800) Subject: Added VFS_IOCtl, Implemented input in vterm X-Git-Tag: rel0.06~545 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=414fb447e4ab5d4f8f456a8de2a16b77eeb1df90;p=tpg%2Facess2.git Added VFS_IOCtl, Implemented input in vterm --- diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index f297b9ff..05c3ab14 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -5,6 +5,7 @@ #include #include #include +#include // === CONSTANTS === #define NUM_VTS 4 @@ -176,6 +177,8 @@ void VT_InitInput() { giVT_InputDevHandle = VFS_Open(gsVT_InputDevice, VFS_OPENFLAG_READ); LOG("giVT_InputDevHandle = %x\n", giVT_InputDevHandle); + if(giVT_InputDevHandle == -1) return ; + VFS_IOCtl(giVT_InputDevHandle, KB_IOCTL_SETCALLBACK, VT_KBCallBack); } /** diff --git a/Kernel/include/vfs_ext.h b/Kernel/include/vfs_ext.h index 6390f84f..53bcc054 100644 --- a/Kernel/include/vfs_ext.h +++ b/Kernel/include/vfs_ext.h @@ -34,6 +34,8 @@ extern Uint64 VFS_Write(int FD, Uint64 Length, void *Buffer); extern Uint64 VFS_ReadAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer); extern Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer); +extern int VFS_IOCtl(int FD, int ID, void *Buffer); + extern void VFS_GetMemPath(void *Base, Uint Length, char *Dest); extern char *VFS_GetTruePath(char *Path); diff --git a/Kernel/vfs/io.c b/Kernel/vfs/io.c index 57d3f84a..689121e7 100644 --- a/Kernel/vfs/io.c +++ b/Kernel/vfs/io.c @@ -166,3 +166,17 @@ int VFS_Seek(int FD, Sint64 Distance, int Whence) h->Position = Distance; return 0; } + +/** + * \fn int VFS_IOCtl(int FD, int ID, void *Buffer) + */ +int VFS_IOCtl(int FD, int ID, void *Buffer) +{ + tVFS_Handle *h; + + h = VFS_GetHandle(FD); + if(!h) return -1; + + if(!h->Node->IOCtl) return -1; + return h->Node->IOCtl(h->Node, ID, Buffer); +}