Cleanups - MM_MapTemp to return void*, VFS use Unlink instead of Relink
[tpg/acess2.git] / KernelLand / Kernel / drv / fifo.c
index 0779a60..cb62193 100644 (file)
@@ -31,9 +31,9 @@ tVFS_Node     *FIFO_FindDir(tVFS_Node *Node, const char *Filename);
  int   FIFO_MkNod(tVFS_Node *Node, const char *Name, Uint Flags);
 void   FIFO_Reference(tVFS_Node *Node);
 void   FIFO_Close(tVFS_Node *Node);
- 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, const void *Buffer);
+ int   FIFO_Unlink(tVFS_Node *Node, const char *OldName);
+size_t FIFO_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer);
+size_t FIFO_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer);
 tPipe  *FIFO_Int_NewPipe(int Size, const char *Name);
 
 // === GLOBALS ===
@@ -43,7 +43,7 @@ tVFS_NodeType gFIFO_DirNodeType = {
        .ReadDir = FIFO_ReadDir,
        .FindDir = FIFO_FindDir,
        .MkNod = FIFO_MkNod,
-       .Relink = FIFO_Relink,
+       .Unlink = FIFO_Unlink,
        .IOCtl = FIFO_IOCtl
 };
 tVFS_NodeType  gFIFO_PipeNodeType = {
@@ -178,12 +178,11 @@ void FIFO_Close(tVFS_Node *Node)
 }
 
 /**
- * \fn int FIFO_Relink(tVFS_Node *Node, const char *OldName, const char *NewName)
- * \brief Relink a file (Deletes named pipes)
+ * \brief Delete a pipe
  */
-int FIFO_Relink(tVFS_Node *Node, const char *OldName, const char *NewName)
+int FIFO_Unlink(tVFS_Node *Node, const char *OldName)
 {
-       tPipe   *pipe, *tmp;
+       tPipe   *pipe;
        
        if(Node != &gFIFO_DriverInfo.RootNode)  return 0;
        
@@ -200,22 +199,6 @@ int FIFO_Relink(tVFS_Node *Node, const char *OldName, const char *NewName)
        }
        if(!pipe)       return 0;
        
-       // Relink a named pipe
-       if(NewName) {
-               // Check new name
-               for(tmp = gFIFO_NamedPipes;
-                       tmp;
-                       tmp = tmp->Next)
-               {
-                       if(strcmp(tmp->Name, NewName) == 0)     return 0;
-               }
-               // Create new name
-               free(pipe->Name);
-               pipe->Name = malloc(strlen(NewName)+1);
-               strcpy(pipe->Name, NewName);
-               return 1;
-       }
-       
        // Unlink the pipe
        if(Node->ImplPtr) {
                free(Node->ImplPtr);
@@ -226,10 +209,9 @@ int FIFO_Relink(tVFS_Node *Node, const char *OldName, const char *NewName)
 }
 
 /**
- * \fn Uint64 FIFO_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
  * \brief Read from a fifo pipe
  */
-Uint64 FIFO_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
+size_t FIFO_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer)
 {
        tPipe   *pipe = Node->ImplPtr;
        Uint    len;
@@ -237,7 +219,7 @@ Uint64 FIFO_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
 
        if(!pipe)       return 0;
        
-       ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
+       ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer);
        
        while(remaining)
        {
@@ -310,10 +292,9 @@ Uint64 FIFO_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
 }
 
 /**
- * \fn Uint64 FIFO_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
  * \brief Write to a fifo pipe
  */
-Uint64 FIFO_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer)
+size_t FIFO_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer)
 {
        tPipe   *pipe = Node->ImplPtr;
        Uint    len;
@@ -321,7 +302,7 @@ Uint64 FIFO_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buf
        
        if(!pipe)       return 0;
 
-       ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
+       ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer);
        
        while(remaining)
        {

UCC git Repository :: git.ucc.asn.au