Kernel - Fixed recursion runaway on Panic() in debug
[tpg/acess2.git] / KernelLand / Kernel / vfs / io.c
index 7379e3d..dc55fe2 100644 (file)
@@ -4,18 +4,19 @@
  */
 #define DEBUG  0
 #include <acess.h>
-#include "vfs.h"
-#include "vfs_int.h"
+#include <vfs.h>
+#include <vfs_ext.h>
+#include <vfs_int.h>
 
 // === CODE ===
 /**
  * \fn Uint64 VFS_Read(int FD, Uint64 Length, void *Buffer)
  * \brief Read data from a node (file)
  */
-Uint64 VFS_Read(int FD, Uint64 Length, void *Buffer)
+size_t VFS_Read(int FD, size_t Length, void *Buffer)
 {
        tVFS_Handle     *h;
-       Uint64  ret;
+       size_t  ret;
        
        ENTER("iFD XLength pBuffer", FD, Length, Buffer);
        
@@ -46,7 +47,7 @@ Uint64 VFS_Read(int FD, Uint64 Length, void *Buffer)
        }
        
        ret = h->Node->Type->Read(h->Node, h->Position, Length, Buffer);
-       if(ret == -1)   LEAVE_RET('i', -1);
+       if(ret == (size_t)-1)   LEAVE_RET('i', -1);
        
        h->Position += ret;
        LEAVE('X', ret);
@@ -57,10 +58,10 @@ Uint64 VFS_Read(int FD, Uint64 Length, void *Buffer)
  * \fn Uint64 VFS_ReadAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer)
  * \brief Read data from a given offset (atomic)
  */
-Uint64 VFS_ReadAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer)
+size_t VFS_ReadAt(int FD, Uint64 Offset, size_t Length, void *Buffer)
 {
        tVFS_Handle     *h;
-       Uint64  ret;
+       size_t  ret;
        
        h = VFS_GetHandle(FD);
        if(!h)  return -1;
@@ -80,7 +81,7 @@ Uint64 VFS_ReadAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer)
        }
        
        ret = h->Node->Type->Read(h->Node, Offset, Length, Buffer);
-       if(ret == -1)   return -1;
+       if(ret == (size_t)-1)   return -1;
        return ret;
 }
 
@@ -88,10 +89,10 @@ Uint64 VFS_ReadAt(int FD, Uint64 Offset, Uint64 Length, void *Buffer)
  * \fn Uint64 VFS_Write(int FD, Uint64 Length, const void *Buffer)
  * \brief Read data from a node (file)
  */
-Uint64 VFS_Write(int FD, Uint64 Length, const void *Buffer)
+size_t VFS_Write(int FD, size_t Length, const void *Buffer)
 {
        tVFS_Handle     *h;
-       Uint64  ret;
+       size_t  ret;
        
        h = VFS_GetHandle(FD);
        if(!h)  return -1;
@@ -108,7 +109,7 @@ Uint64 VFS_Write(int FD, Uint64 Length, const void *Buffer)
        }
        
        ret = h->Node->Type->Write(h->Node, h->Position, Length, Buffer);
-       if(ret == -1)   return -1;
+       if(ret == (size_t)-1)   return -1;
 
        h->Position += ret;
        return ret;
@@ -118,10 +119,10 @@ Uint64 VFS_Write(int FD, Uint64 Length, const void *Buffer)
  * \fn Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, const void *Buffer)
  * \brief Write data to a file at a given offset
  */
-Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, const void *Buffer)
+size_t VFS_WriteAt(int FD, Uint64 Offset, size_t Length, const void *Buffer)
 {
        tVFS_Handle     *h;
-       Uint64  ret;
+       size_t  ret;
        
        h = VFS_GetHandle(FD);
        if(!h)  return -1;
@@ -137,7 +138,7 @@ Uint64 VFS_WriteAt(int FD, Uint64 Offset, Uint64 Length, const void *Buffer)
                return -1;
        }
        ret = h->Node->Type->Write(h->Node, Offset, Length, Buffer);
-       if(ret == -1)   return -1;
+       if(ret == (size_t)-1)   return -1;
        return ret;
 }
 
@@ -180,7 +181,7 @@ int VFS_Seek(int FD, Sint64 Offset, int Whence)
        
        // Set relative to end of file
        if(Whence < 0) {
-               if( h->Node->Size == -1 )       return -1;
+               if( h->Node->Size == (Uint64)-1 )       return -1;
 
                h->Position = h->Node->Size - Offset;
                return 0;

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