/* AcessOS
* FIFO Pipe Driver
*/
-#include <common.h>
+#include <acess.h>
#include <modules.h>
#include <fs_devfs.h>
int FIFO_Install(char **Arguments);
int FIFO_IOCtl(tVFS_Node *Node, int Id, void *Data);
char *FIFO_ReadDir(tVFS_Node *Node, int Id);
-tVFS_Node *FIFO_FindDir(tVFS_Node *Node, char *Filename);
- int FIFO_MkNod(tVFS_Node *Node, char *Name, Uint Flags);
+tVFS_Node *FIFO_FindDir(tVFS_Node *Node, const char *Filename);
+ int FIFO_MkNod(tVFS_Node *Node, const char *Name, Uint Flags);
void FIFO_Close(tVFS_Node *Node);
- int FIFO_Relink(tVFS_Node *Node, char *OldName, char *NewName);
+ int FIFO_Relink(tVFS_Node *Node, const char *OldName, const char *NewName);
Uint64 FIFO_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
Uint64 FIFO_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
tPipe *FIFO_Int_NewPipe(int Size, char *Name);
tDevFS_Driver gFIFO_DriverInfo = {
NULL, "fifo",
{
+ .Size = 1,
.NumACLs = 1,
.ACLs = &gVFS_ACL_EveryoneRW,
.Flags = VFS_FFLAG_DIRECTORY,
int FIFO_Install(char **Options)
{
DevFS_AddDevice( &gFIFO_DriverInfo );
- return 0;
+ return MODULE_ERR_OK;
}
/**
char *FIFO_ReadDir(tVFS_Node *Node, int Id)
{
tPipe *tmp = gFIFO_NamedPipes;
+
// Entry 0 is Anon Pipes
if(Id == 0) return strdup("anon");
}
/**
- * \fn tVFS_Node *FIFO_FindDir(tVFS_Node *Node, char *Filename)
+ * \fn tVFS_Node *FIFO_FindDir(tVFS_Node *Node, const char *Filename)
* \brief Find a file in the FIFO root
* \note Creates an anon pipe if anon is requested
*/
-tVFS_Node *FIFO_FindDir(tVFS_Node *Node, char *Filename)
+tVFS_Node *FIFO_FindDir(tVFS_Node *Node, const char *Filename)
{
tPipe *tmp;
if(!Filename) return NULL;
}
/**
- * \fn int FIFO_MkNod(tVFS_Node *Node, char *Name, Uint Flags)
+ * \fn int FIFO_MkNod(tVFS_Node *Node, const char *Name, Uint Flags)
*/
-int FIFO_MkNod(tVFS_Node *Node, char *Name, Uint Flags)
+int FIFO_MkNod(tVFS_Node *Node, const char *Name, Uint Flags)
{
return 0;
}
/**
- * \fn void FIFO_Close(vfs_node *Node)
+ * \fn void FIFO_Close(tVFS_Node *Node)
+ * \brief Close a FIFO end
*/
void FIFO_Close(tVFS_Node *Node)
{
}
/**
- * \fn int FIFO_Relink(tVFS_Node *Node, char *OldName, char *NewName)
+ * \fn int FIFO_Relink(tVFS_Node *Node, const char *OldName, const char *NewName)
* \brief Relink a file (Deletes named pipes)
*/
-int FIFO_Relink(tVFS_Node *Node, char *OldName, char *NewName)
+int FIFO_Relink(tVFS_Node *Node, const char *OldName, const char *NewName)
{
tPipe *pipe, *tmp;
while(remaining)
{
// Wait for buffer to fill
- if(pipe->Flags & PF_BLOCKING)
- while(pipe->ReadPos == pipe->WritePos)
+ if(pipe->Flags & PF_BLOCKING) {
+ while(pipe->ReadPos == pipe->WritePos) {
Threads_Yield();
+ //MAGIC_BREAK();
+ }
+ }
else
if(pipe->ReadPos == pipe->WritePos)
return 0;
memset(ret, 0, allocsize);
ret->Name = Name;
+ ret->Flags = PF_BLOCKING;
// Allocate Buffer
ret->BufSize = Size;