3 * - By John Hodge (thePowersGang)
6 * - /Devices/{null,zero,one}
14 int CoreDevs_Install(char **Arguments);
15 size_t CoreDevs_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer);
16 size_t CoreDevs_Read_Zero(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer);
17 size_t CoreDevs_Read_One (tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer);
18 size_t CoreDevs_Read_Null(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer);
21 MODULE_DEFINE(0, 0x0100, CoreDevs, CoreDevs_Install, NULL, NULL);
22 tVFS_NodeType gCoreDevs_NT_Null = {
23 .TypeName = "CoreDevs-null",
24 .Read = CoreDevs_Read_Null,
25 .Write = CoreDevs_Write
27 tVFS_NodeType gCoreDevs_NT_Zero = {
28 .TypeName = "CoreDevs-zero",
29 .Read = CoreDevs_Read_Zero,
30 .Write = CoreDevs_Write
32 tVFS_NodeType gCoreDevs_NT_One = {
33 .TypeName = "CoreDevs-one",
34 .Read = CoreDevs_Read_One,
35 .Write = CoreDevs_Write
37 tDevFS_Driver gCoreDevs_Null = {
42 .ACLs = &gVFS_ACL_EveryoneRW,
43 .Type = &gCoreDevs_NT_Null
46 tDevFS_Driver gCoreDevs_Zero = {
51 .ACLs = &gVFS_ACL_EveryoneRW,
52 .Type = &gCoreDevs_NT_Zero
55 tDevFS_Driver gCoreDevs_One = {
60 .ACLs = &gVFS_ACL_EveryoneRW,
61 .Type = &gCoreDevs_NT_One
67 * \brief Installs the CoreDevs driver
69 int CoreDevs_Install(char **Options)
71 DevFS_AddDevice( &gCoreDevs_Null );
72 DevFS_AddDevice( &gCoreDevs_Zero );
73 DevFS_AddDevice( &gCoreDevs_One );
77 size_t CoreDevs_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer)
79 return Length; // Ignore
82 size_t CoreDevs_Read_Zero(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer)
84 memset(Buffer, 0, Length);
88 size_t CoreDevs_Read_One (tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer)
92 for( rem = Length; rem --; ptr ++ )
97 size_t CoreDevs_Read_Null(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer)