From: John Hodge Date: Fri, 17 Feb 2012 05:37:32 +0000 (+0800) Subject: Kernel - Update VFS API to use off_t/size_t instead of Uint64 X-Git-Tag: rel0.15~765 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=880dd63bfcba522dab0a75cc63fdec1d04ff8c89;p=tpg%2Facess2.git Kernel - Update VFS API to use off_t/size_t instead of Uint64 - Also fixed compilation issues in x86_64/ARMv7 --- diff --git a/KernelLand/Kernel/drv/fifo.c b/KernelLand/Kernel/drv/fifo.c index 0779a60b..94e8aaeb 100644 --- a/KernelLand/Kernel/drv/fifo.c +++ b/KernelLand/Kernel/drv/fifo.c @@ -32,8 +32,8 @@ tVFS_Node *FIFO_FindDir(tVFS_Node *Node, const char *Filename); 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); +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 === @@ -226,10 +226,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 +236,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 +309,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 +319,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) { diff --git a/KernelLand/Kernel/drv/pci.c b/KernelLand/Kernel/drv/pci.c index 8745080b..327d651d 100644 --- a/KernelLand/Kernel/drv/pci.c +++ b/KernelLand/Kernel/drv/pci.c @@ -35,7 +35,7 @@ typedef struct sPCIDevice char *PCI_int_ReadDirRoot(tVFS_Node *node, int pos); tVFS_Node *PCI_int_FindDirRoot(tVFS_Node *node, const char *filename); Uint32 PCI_int_GetBusAddr(Uint16 Bus, Uint16 Slot, Uint16 Fcn, Uint8 Offset); -Uint64 PCI_int_ReadDevice(tVFS_Node *node, Uint64 pos, Uint64 length, void *buffer); +size_t PCI_int_ReadDevice(tVFS_Node *node, off_t Offset, size_t Length, void *buffer); int PCI_int_EnumDevice(Uint16 bus, Uint16 dev, Uint16 fcn, tPCIDevice *info); // === GLOBALS === @@ -235,8 +235,9 @@ tVFS_Node *PCI_int_FindDirRoot(tVFS_Node *node, const char *filename) } /** + * \brief Read the PCI configuration space of a device */ -Uint64 PCI_int_ReadDevice(tVFS_Node *node, Uint64 pos, Uint64 length, void *buffer) +size_t PCI_int_ReadDevice(tVFS_Node *node, off_t pos, size_t length, void *buffer) { if( pos + length > 256 ) return 0; diff --git a/KernelLand/Kernel/drv/proc.c b/KernelLand/Kernel/drv/proc.c index 73f45354..4f52f5ca 100644 --- a/KernelLand/Kernel/drv/proc.c +++ b/KernelLand/Kernel/drv/proc.c @@ -33,7 +33,7 @@ typedef struct sSysFS_Ent char *SysFS_Comm_ReadDir(tVFS_Node *Node, int Id); tVFS_Node *SysFS_Comm_FindDir(tVFS_Node *Node, const char *Filename); -Uint64 SysFS_Comm_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +size_t SysFS_Comm_ReadFile(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); void SysFS_Comm_CloseFile(tVFS_Node *Node); // === GLOBALS === @@ -357,10 +357,9 @@ tVFS_Node *SysFS_Comm_FindDir(tVFS_Node *Node, const char *Filename) } /** - * \fn Uint64 SysFS_Comm_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Read from an exposed buffer */ -Uint64 SysFS_Comm_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t SysFS_Comm_ReadFile(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { if( Offset > Node->Size ) return -1; if( Length > Node->Size ) Length = Node->Size; diff --git a/KernelLand/Kernel/drv/vterm.c b/KernelLand/Kernel/drv/vterm.c index 5bce8a16..f3769187 100644 --- a/KernelLand/Kernel/drv/vterm.c +++ b/KernelLand/Kernel/drv/vterm.c @@ -37,8 +37,8 @@ extern void Debug_SetKTerminal(const char *File); char *VT_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *VT_FindDir(tVFS_Node *Node, const char *Name); int VT_Root_IOCtl(tVFS_Node *Node, int Id, void *Data); -Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 VT_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t VT_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t VT_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); int VT_Terminal_IOCtl(tVFS_Node *Node, int Id, void *Data); // === CONSTANTS === @@ -344,7 +344,7 @@ int VT_Root_IOCtl(tVFS_Node *Node, int Id, void *Data) /** * \brief Read from a virtual terminal */ -Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t VT_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { int pos = 0; int avail; @@ -420,10 +420,9 @@ Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) } /** - * \fn Uint64 VT_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) * \brief Write to a virtual terminal */ -Uint64 VT_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t VT_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { tVTerm *term = &gVT_Terminals[ Node->Inode ]; int size; diff --git a/KernelLand/Kernel/include/acess.h b/KernelLand/Kernel/include/acess.h index ea96031b..25077ca4 100644 --- a/KernelLand/Kernel/include/acess.h +++ b/KernelLand/Kernel/include/acess.h @@ -45,6 +45,7 @@ typedef Sint64 tTimestamp; //!< Timestamp (miliseconds since 00:00 1 Jan 1970) typedef Sint64 tTime; //!< Same again typedef struct sShortSpinlock tShortSpinlock; //!< Opaque (kinda) spinlock typedef int bool; //!< Boolean type +typedef Uint64 off_t; //!< VFS Offset // --- Helper Macros --- /** @@ -402,7 +403,7 @@ extern Uint32 SwapEndian32(Uint32 Val); * \{ */ extern int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args); -extern size_t snprintf(char *__s, size_t __n, const char *__format, ...); +extern int snprintf(char *__s, size_t __n, const char *__format, ...); extern int sprintf(char *__s, const char *__format, ...); extern size_t strlen(const char *Str); extern char *strcpy(char *__dest, const char *__src); diff --git a/KernelLand/Kernel/include/vfs.h b/KernelLand/Kernel/include/vfs.h index 1aa073b2..7d0a26db 100644 --- a/KernelLand/Kernel/include/vfs.h +++ b/KernelLand/Kernel/include/vfs.h @@ -135,9 +135,9 @@ typedef struct sVFS_Node * \name Times * \{ */ - Sint64 ATime; //!< Last Accessed Time - Sint64 MTime; //!< Last Modified Time - Sint64 CTime; //!< Creation Time + tTime ATime; //!< Last Accessed Time + tTime MTime; //!< Last Modified Time + tTime CTime; //!< Creation Time /** * \} */ @@ -242,7 +242,7 @@ struct sVFS_NodeType * \param Buffer Destination for read data * \return Number of bytes read */ - Uint64 (*Read)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); + size_t (*Read)(struct sVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); /** * \brief Write to the file * \param Node Pointer to this node @@ -251,7 +251,7 @@ struct sVFS_NodeType * \param Buffer Source of written data * \return Number of bytes read */ - Uint64 (*Write)(struct sVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); + size_t (*Write)(struct sVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); /** * \brief Map a region of a file into memory @@ -262,7 +262,7 @@ struct sVFS_NodeType * \return Boolean Failure * \note If NULL, the VFS implements it using .Read */ - int (*MMap)(struct sVFS_Node *Node, Uint64 Offset, int Length, void *Dest); + int (*MMap)(struct sVFS_Node *Node, off_t Offset, int Length, void *Dest); /** * \} diff --git a/KernelLand/Kernel/lib.c b/KernelLand/Kernel/lib.c index 3c97ab78..7356d6fe 100644 --- a/KernelLand/Kernel/lib.c +++ b/KernelLand/Kernel/lib.c @@ -20,7 +20,7 @@ const short DAYS_BEFORE[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 3 int ParseInt(const char *string, int *Val); void itoa(char *buf, Uint64 num, int base, int minLength, char pad); int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args); -size_t snprintf(char *__s, size_t __n, const char *__format, ...); + int snprintf(char *__s, size_t __n, const char *__format, ...); int sprintf(char *__s, const char *__format, ...); #endif int tolower(int c); @@ -58,6 +58,7 @@ void format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, EXPORT(atoi); EXPORT(itoa); EXPORT(vsnprintf); +EXPORT(snprintf); EXPORT(sprintf); EXPORT(tolower); EXPORT(strucmp); @@ -412,7 +413,7 @@ int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args) /** */ -size_t snprintf(char *__s, size_t __n, const char *__format, ...) +int snprintf(char *__s, size_t __n, const char *__format, ...) { va_list args; int ret; diff --git a/KernelLand/Kernel/vfs/fs/root.c b/KernelLand/Kernel/vfs/fs/root.c index bee20305..00829edf 100644 --- a/KernelLand/Kernel/vfs/fs/root.c +++ b/KernelLand/Kernel/vfs/fs/root.c @@ -16,8 +16,8 @@ tVFS_Node *Root_InitDevice(const char *Device, const char **Options); int Root_MkNod(tVFS_Node *Node, const char *Name, Uint Flags); tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name); char *Root_ReadDir(tVFS_Node *Node, int Pos); -Uint64 Root_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 Root_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); tRamFS_File *Root_int_AllocFile(void); // === GLOBALS === @@ -176,39 +176,32 @@ char *Root_ReadDir(tVFS_Node *Node, int Pos) } /** - * \fn Uint64 Root_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Read from a file in the root directory */ -Uint64 Root_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tRamFS_File *file = Node->ImplPtr; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); - - if(Offset > Node->Size) { - LEAVE('i', 0); - return 0; - } - if(Length > Node->Size) Length = Node->Size; + if(Offset > Node->Size) return 0; + + if(Length > Node->Size) + Length = Node->Size; if(Offset+Length > Node->Size) Length = Node->Size - Offset; memcpy(Buffer, file->Data.Bytes+Offset, Length); - LOG("Buffer = '%.*s'", (int)Length, Buffer); - - LEAVE('i', Length); + return Length; } /** - * \fn Uint64 Root_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Write to a file in the root directory */ -Uint64 Root_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { tRamFS_File *file = Node->ImplPtr; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); + ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer); if(Offset > Node->Size) { LEAVE('i', -1); diff --git a/KernelLand/Kernel/vfs/memfile.c b/KernelLand/Kernel/vfs/memfile.c index 14b39481..f019c3d3 100644 --- a/KernelLand/Kernel/vfs/memfile.c +++ b/KernelLand/Kernel/vfs/memfile.c @@ -9,8 +9,8 @@ // === PROTOTYPES === tVFS_Node *VFS_MemFile_Create(const char *Path); void VFS_MemFile_Close(tVFS_Node *Node); -Uint64 VFS_MemFile_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 VFS_MemFile_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t VFS_MemFile_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t VFS_MemFile_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); // === GLOBALS === tVFS_NodeType gVFS_MemFileType = { @@ -91,10 +91,9 @@ void VFS_MemFile_Close(tVFS_Node *Node) } /** - * \fn Uint64 VFS_MemFile_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Read from a memory file */ -Uint64 VFS_MemFile_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t VFS_MemFile_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { // Check for use of free'd file if(Node->ImplPtr == NULL) return 0; @@ -103,6 +102,8 @@ Uint64 VFS_MemFile_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buf if(Offset > Node->Size) return 0; // Truncate data read if needed + if(Length > Node->Size) + Length = Node->Size; if(Offset + Length > Node->Size) Length = Node->Size - Offset; @@ -113,10 +114,9 @@ Uint64 VFS_MemFile_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buf } /** - * \fn Uint64 VFS_MemFile_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Write to a memory file */ -Uint64 VFS_MemFile_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t VFS_MemFile_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { // Check for use of free'd file if(Node->ImplPtr == NULL) return 0; @@ -125,6 +125,8 @@ Uint64 VFS_MemFile_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const vo if(Offset > Node->Size) return 0; // Truncate data read if needed + if(Length > Node->Size) + Length = Node->Size; if(Offset + Length > Node->Size) Length = Node->Size - Offset; diff --git a/KernelLand/Modules/Display/BochsGA/bochsvbe.c b/KernelLand/Modules/Display/BochsGA/bochsvbe.c index 806c1c13..4e0e600d 100644 --- a/KernelLand/Modules/Display/BochsGA/bochsvbe.c +++ b/KernelLand/Modules/Display/BochsGA/bochsvbe.c @@ -63,8 +63,8 @@ void BGA_int_SetMode(Uint16 width, Uint16 height); int BGA_int_ModeInfo(tVideo_IOCtl_Mode *info); int BGA_int_MapFB(void *Dest); // Filesystem -Uint64 BGA_Read(tVFS_Node *Node, Uint64 off, Uint64 len, void *buffer); -Uint64 BGA_Write(tVFS_Node *Node, Uint64 off, Uint64 len, const void *buffer); +size_t BGA_Read(tVFS_Node *Node, off_t off, size_t len, void *buffer); +size_t BGA_Write(tVFS_Node *Node, off_t off, size_t len, const void *buffer); int BGA_IOCtl(tVFS_Node *Node, int ID, void *Data); // === GLOBALS === @@ -141,10 +141,9 @@ void BGA_Uninstall(void) } /** - * \fn Uint64 BGA_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) * \brief Read from the framebuffer */ -Uint64 BGA_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) +size_t BGA_Read(tVFS_Node *node, off_t off, size_t len, void *buffer) { // Check Mode if(giBGA_CurrentMode == -1) return -1; @@ -161,7 +160,7 @@ Uint64 BGA_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) /** * \brief Write to the framebuffer */ -Uint64 BGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t BGA_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { if( giBGA_CurrentMode == -1 ) BGA_int_UpdateMode(0); return DrvUtil_Video_WriteLFB(&gBGA_DrvUtil_BufInfo, Offset, Length, Buffer); diff --git a/KernelLand/Modules/Display/PL110/main.c b/KernelLand/Modules/Display/PL110/main.c index c3b6e526..e1e3ff8d 100644 --- a/KernelLand/Modules/Display/PL110/main.c +++ b/KernelLand/Modules/Display/PL110/main.c @@ -64,8 +64,8 @@ const int ciPL110_ModeCount = sizeof(caPL110_Modes)/sizeof(caPL110_Modes[0]); void PL110_Uninstall(); // Internal // Filesystem -Uint64 PL110_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer); -Uint64 PL110_Write(tVFS_Node *node, Uint64 off, Uint64 len, const void *buffer); +size_t PL110_Read(tVFS_Node *node, off_t Offset, size_t len, void *buffer); +size_t PL110_Write(tVFS_Node *node, off_t offset, size_t len, const void *buffer); int PL110_IOCtl(tVFS_Node *node, int id, void *data); // -- Internals int PL110_int_SetResolution(int W, int H); @@ -132,7 +132,7 @@ void PL110_Uninstall() /** * \brief Read from the framebuffer */ -Uint64 PL110_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) +size_t PL110_Read(tVFS_Node *node, off_t off, size_t len, void *buffer) { return 0; } @@ -140,7 +140,7 @@ Uint64 PL110_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) /** * \brief Write to the framebuffer */ -Uint64 PL110_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t PL110_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { gPL110_DrvUtil_BufInfo.BufferFormat = giPL110_BufferMode; return DrvUtil_Video_WriteLFB(&gPL110_DrvUtil_BufInfo, Offset, Length, Buffer); diff --git a/KernelLand/Modules/Display/Tegra2Vid/main.c b/KernelLand/Modules/Display/Tegra2Vid/main.c index 72ac697b..da71057e 100644 --- a/KernelLand/Modules/Display/Tegra2Vid/main.c +++ b/KernelLand/Modules/Display/Tegra2Vid/main.c @@ -23,21 +23,22 @@ void Tegra2Vid_Uninstall(); // Internal // Filesystem -Uint64 Tegra2Vid_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer); -Uint64 Tegra2Vid_Write(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer); +size_t Tegra2Vid_Read(tVFS_Node *node, off_t off, size_t len, void *buffer); +size_t Tegra2Vid_Write(tVFS_Node *node, off_t off, size_t len, const void *buffer); int Tegra2Vid_IOCtl(tVFS_Node *node, int id, void *data); // -- Internals int Tegra2Vid_int_SetMode(int Mode); // === GLOBALS === MODULE_DEFINE(0, VERSION, Tegra2Vid, Tegra2Vid_Install, NULL, NULL); -tDevFS_Driver gTegra2Vid_DriverStruct = { - NULL, "Tegra2Vid", - { +tVFS_NodeType gTegra2Vid_NodeType = { .Read = Tegra2Vid_Read, .Write = Tegra2Vid_Write, .IOCtl = Tegra2Vid_IOCtl - } + }; +tDevFS_Driver gTegra2Vid_DriverStruct = { + NULL, "Tegra2Vid", + {.Type = &gTegra2Vid_NodeType} }; // -- Options tPAddr gTegra2Vid_PhysBase = TEGRA2VID_BASE; @@ -109,7 +110,7 @@ int Tegra2Vid_Install(char **Arguments) *(gpTegra2Vid_IOMem[DC_WIN_A_SIZE_0]>>16)*4; Log_Debug("Tegra2Vid", "giTegra2Vid_FramebufferSize = 0x%x", giTegra2Vid_FramebufferSize); - gpTegra2Vid_Framebuffer = MM_MapHWPages( + gpTegra2Vid_Framebuffer = (void*)MM_MapHWPages( gpTegra2Vid_IOMem[DC_WINBUF_A_START_ADDR_0], (giTegra2Vid_FramebufferSize+PAGE_SIZE-1)/PAGE_SIZE ); @@ -141,7 +142,7 @@ void Tegra2Vid_Uninstall() /** * \brief Read from the framebuffer */ -Uint64 Tegra2Vid_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) +size_t Tegra2Vid_Read(tVFS_Node *node, off_t off, size_t len, void *buffer) { return 0; } @@ -149,7 +150,7 @@ Uint64 Tegra2Vid_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) /** * \brief Write to the framebuffer */ -Uint64 Tegra2Vid_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Tegra2Vid_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { gTegra2Vid_DrvUtil_BufInfo.BufferFormat = giTegra2Vid_BufferMode; return DrvUtil_Video_WriteLFB(&gTegra2Vid_DrvUtil_BufInfo, Offset, Length, Buffer); @@ -202,7 +203,7 @@ int Tegra2Vid_IOCtl(tVFS_Node *Node, int ID, void *Data) case VIDEO_IOCTL_FINDMODE: { tVideo_IOCtl_Mode *mode = Data; - int closest, closestArea, reqArea = 0; + int closest=0, closestArea, reqArea = 0; if(!Data || !CheckMem(Data, sizeof(tVideo_IOCtl_Mode))) LEAVE_RET('i', -1); if( mode->bpp != 32 ) diff --git a/KernelLand/Modules/Display/VESA/main.c b/KernelLand/Modules/Display/VESA/main.c index c57d57d2..2dbc98ce 100644 --- a/KernelLand/Modules/Display/VESA/main.c +++ b/KernelLand/Modules/Display/VESA/main.c @@ -24,8 +24,7 @@ // === PROTOTYPES === int Vesa_Install(char **Arguments); -Uint64 Vesa_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t Vesa_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); int Vesa_IOCtl(tVFS_Node *Node, int ID, void *Data); int Vesa_Int_SetMode(int Mode); int Vesa_Int_FindMode(tVideo_IOCtl_Mode *data); @@ -37,7 +36,6 @@ void Vesa_FlipCursor(void *Arg); // === GLOBALS === MODULE_DEFINE(0, VERSION, Vesa, Vesa_Install, NULL, "PCI", "VM8086", NULL); tVFS_NodeType gVesa_NodeType = { - .Read = Vesa_Read, .Write = Vesa_Write, .IOCtl = Vesa_IOCtl }; @@ -174,20 +172,10 @@ void Vesa_int_FillModeList(void) } } -/* Read from the framebuffer - */ -Uint64 Vesa_Read(tVFS_Node *Node, Uint64 off, Uint64 len, void *buffer) -{ - #if DEBUG >= 2 - Log("Vesa_Read: () - NULL\n"); - #endif - return 0; -} - /** * \brief Write to the framebuffer */ -Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t Vesa_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { if( gVesa_Modes[giVesaCurrentMode].framebuffer == 0 ) { Log_Warning("VESA", "Vesa_Write - Non-LFB Modes not yet supported."); diff --git a/KernelLand/Modules/Filesystems/Ext2/ext2_common.h b/KernelLand/Modules/Filesystems/Ext2/ext2_common.h index 6ef9d7c8..f151f2c4 100644 --- a/KernelLand/Modules/Filesystems/Ext2/ext2_common.h +++ b/KernelLand/Modules/Filesystems/Ext2/ext2_common.h @@ -40,8 +40,8 @@ extern tVFS_Node *Ext2_FindDir(tVFS_Node *Node, const char *FileName); extern int Ext2_MkNod(tVFS_Node *Node, const char *Name, Uint Flags); extern int Ext2_Link(tVFS_Node *Parent, tVFS_Node *Node, const char *Name); // --- Read --- -extern Uint64 Ext2_Read(tVFS_Node *node, Uint64 offset, Uint64 length, void *buffer); +extern size_t Ext2_Read(tVFS_Node *node, off_t offset, size_t length, void *buffer); // --- Write --- -extern Uint64 Ext2_Write(tVFS_Node *node, Uint64 offset, Uint64 length, const void *buffer); +extern size_t Ext2_Write(tVFS_Node *node, off_t offset, size_t length, const void *buffer); #endif diff --git a/KernelLand/Modules/Filesystems/Ext2/read.c b/KernelLand/Modules/Filesystems/Ext2/read.c index 81f5ee64..6244d9dc 100644 --- a/KernelLand/Modules/Filesystems/Ext2/read.c +++ b/KernelLand/Modules/Filesystems/Ext2/read.c @@ -11,15 +11,11 @@ #define VERBOSE 0 #include "ext2_common.h" -// === PROTOTYPES === -Uint64 Ext2_Read(tVFS_Node *node, Uint64 offset, Uint64 length, void *buffer); - // === CODE === /** - * \fn Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Read from a file */ -Uint64 Ext2_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Ext2_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tExt2_Disk *disk = Node->ImplPtr; tExt2_Inode inode; diff --git a/KernelLand/Modules/Filesystems/Ext2/write.c b/KernelLand/Modules/Filesystems/Ext2/write.c index 03109e8a..60b176ca 100644 --- a/KernelLand/Modules/Filesystems/Ext2/write.c +++ b/KernelLand/Modules/Filesystems/Ext2/write.c @@ -18,10 +18,9 @@ void Ext2_int_DeallocateBlock(tExt2_Disk *Disk, Uint32 Block); // === CODE === /** - * \fn Uint64 Ext2_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Write to a file */ -Uint64 Ext2_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t Ext2_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { tExt2_Disk *disk = Node->ImplPtr; tExt2_Inode inode; diff --git a/KernelLand/Modules/Filesystems/FAT/fat.c b/KernelLand/Modules/Filesystems/FAT/fat.c index f5d19161..c69a063e 100644 --- a/KernelLand/Modules/Filesystems/FAT/fat.c +++ b/KernelLand/Modules/Filesystems/FAT/fat.c @@ -67,10 +67,10 @@ Uint32 FAT_int_FreeCluster(tFAT_VolInfo *Disk, Uint32 Cluster); #endif void FAT_int_ReadCluster(tFAT_VolInfo *Disk, Uint32 Cluster, int Length, void *Buffer); // --- File IO -Uint64 FAT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +size_t FAT_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); #if SUPPORT_WRITE void FAT_int_WriteCluster(tFAT_VolInfo *Disk, Uint32 Cluster, void *Buffer); -Uint64 FAT_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +size_t FAT_Write(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); #endif // --- Directory IO char *FAT_ReadDir(tVFS_Node *Node, int ID); @@ -616,10 +616,9 @@ void FAT_int_ReadCluster(tFAT_VolInfo *Disk, Uint32 Cluster, int Length, void *B * ==================== */ /** - * \fn Uint64 FAT_Read(tVFS_Node *node, Uint64 offset, Uint64 length, void *buffer) * \brief Reads data from a specified file */ -Uint64 FAT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t FAT_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { int preSkip, count; Uint64 final_bytes; @@ -628,7 +627,7 @@ Uint64 FAT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) char tmpBuf[disk->BytesPerCluster]; int bpc = disk->BytesPerCluster; - ENTER("pNode Xoffset Xlength pbuffer", Node, Offset, Length, Buffer); + ENTER("pNode Xoffset xlength pbuffer", Node, Offset, Length, Buffer); // Sanity Check offset if(Offset > Node->Size) { @@ -754,7 +753,7 @@ void FAT_int_WriteCluster(tFAT_VolInfo *Disk, Uint32 Cluster, void *Buffer) * \param Length Size of data to write * \param Buffer Data source */ -Uint64 FAT_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t FAT_Write(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tFAT_VolInfo *disk = Node->ImplPtr; char tmpBuf[disk->BytesPerCluster]; diff --git a/KernelLand/Modules/Filesystems/InitRD/initrd.h b/KernelLand/Modules/Filesystems/InitRD/initrd.h index 479a8418..92af1144 100644 --- a/KernelLand/Modules/Filesystems/InitRD/initrd.h +++ b/KernelLand/Modules/Filesystems/InitRD/initrd.h @@ -14,7 +14,7 @@ typedef struct sInitRD_File // === Functions === -extern Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Size, void *Buffer); +extern size_t InitRD_ReadFile(tVFS_Node *Node, off_t Offset, size_t Size, void *Buffer); extern char *InitRD_ReadDir(tVFS_Node *Node, int ID); extern tVFS_Node *InitRD_FindDir(tVFS_Node *Node, const char *Name); diff --git a/KernelLand/Modules/Filesystems/InitRD/main.c b/KernelLand/Modules/Filesystems/InitRD/main.c index b52ab8de..a75ecfa2 100644 --- a/KernelLand/Modules/Filesystems/InitRD/main.c +++ b/KernelLand/Modules/Filesystems/InitRD/main.c @@ -17,7 +17,7 @@ extern tVFS_Node * const gInitRD_FileList[]; tVFS_Node *InitRD_InitDevice(const char *Device, const char **Arguments); void InitRD_Unmount(tVFS_Node *Node); tVFS_Node *InitRD_GetNodeFromINode(tVFS_Node *Root, Uint64 Inode); -Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Size, void *Buffer); +size_t InitRD_ReadFile(tVFS_Node *Node, off_t Offset, size_t Size, void *Buffer); char *InitRD_ReadDir(tVFS_Node *Node, int ID); tVFS_Node *InitRD_FindDir(tVFS_Node *Node, const char *Name); void InitRD_DumpDir(tVFS_Node *Node, int Indent); @@ -28,7 +28,7 @@ tVFS_Driver gInitRD_FSInfo = { "initrd", 0, InitRD_InitDevice, InitRD_Unmount, InitRD_GetNodeFromINode }; tVFS_NodeType gInitRD_DirType = { - .ReadDir = InitRD_ReadFile, + .ReadDir = InitRD_ReadDir, .FindDir = InitRD_FindDir }; tVFS_NodeType gInitRD_FileType = { @@ -76,7 +76,7 @@ tVFS_Node *InitRD_GetNodeFromINode(tVFS_Node *Root, Uint64 Inode) /** * \brief Read from a file */ -Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t InitRD_ReadFile(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { if(Offset > Node->Size) return 0; diff --git a/KernelLand/Modules/IPStack/arp.c b/KernelLand/Modules/IPStack/arp.c index abaea275..9dd48b95 100644 --- a/KernelLand/Modules/IPStack/arp.c +++ b/KernelLand/Modules/IPStack/arp.c @@ -7,6 +7,7 @@ #include "ipstack.h" #include "arp.h" #include "link.h" +#include "ipv4.h" // For IPv4_Netmask #define ARPv6 0 #define ARP_CACHE_SIZE 64 diff --git a/KernelLand/Modules/IPStack/ipv4.h b/KernelLand/Modules/IPStack/ipv4.h index 2c3e1cae..7c69a623 100644 --- a/KernelLand/Modules/IPStack/ipv4.h +++ b/KernelLand/Modules/IPStack/ipv4.h @@ -47,6 +47,7 @@ struct sIPv4Header // === FUNCTIONS === extern int IPv4_RegisterCallback(int ID, tIPCallback Callback); extern Uint16 IPv4_Checksum(const void *Buf, size_t Length); +extern Uint32 IPv4_Netmask(int FixedBits); extern int IPv4_SendPacket(tInterface *Iface, tIPv4 Address, int Protocol, int ID, int Length, const void *Data); #endif diff --git a/KernelLand/Modules/IPStack/tcp.c b/KernelLand/Modules/IPStack/tcp.c index e9c3de98..20c22f80 100644 --- a/KernelLand/Modules/IPStack/tcp.c +++ b/KernelLand/Modules/IPStack/tcp.c @@ -39,8 +39,8 @@ tVFS_Node *TCP_Server_FindDir(tVFS_Node *Node, const char *Name); void TCP_Server_Close(tVFS_Node *Node); // --- Client tVFS_Node *TCP_Client_Init(tInterface *Interface); -Uint64 TCP_Client_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 TCP_Client_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t TCP_Client_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t TCP_Client_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); int TCP_Client_IOCtl(tVFS_Node *Node, int ID, void *Data); void TCP_Client_Close(tVFS_Node *Node); // --- Helpers @@ -1065,7 +1065,7 @@ tVFS_Node *TCP_Client_Init(tInterface *Interface) * \note If \a Length is smaller than the size of the packet, the rest * of the packet's data will be discarded. */ -Uint64 TCP_Client_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t TCP_Client_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tTCPConnection *conn = Node->ImplPtr; size_t len; @@ -1147,7 +1147,7 @@ void TCP_INT_SendDataPacket(tTCPConnection *Connection, size_t Length, const voi /** * \brief Send some bytes on a connection */ -Uint64 TCP_Client_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t TCP_Client_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { tTCPConnection *conn = Node->ImplPtr; size_t rem = Length; diff --git a/KernelLand/Modules/IPStack/udp.c b/KernelLand/Modules/IPStack/udp.c index cbdcd56b..0f6ec3df 100644 --- a/KernelLand/Modules/IPStack/udp.c +++ b/KernelLand/Modules/IPStack/udp.c @@ -15,8 +15,8 @@ void UDP_Unreachable(tInterface *Interface, int Code, void *Address, int Length, void UDP_SendPacketTo(tUDPChannel *Channel, int AddrType, const void *Address, Uint16 Port, const void *Data, size_t Length); // --- Client Channels tVFS_Node *UDP_Channel_Init(tInterface *Interface); -Uint64 UDP_Channel_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 UDP_Channel_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t UDP_Channel_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t UDP_Channel_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); int UDP_Channel_IOCtl(tVFS_Node *Node, int ID, void *Data); void UDP_Channel_Close(tVFS_Node *Node); // --- Helpers @@ -189,7 +189,7 @@ tVFS_Node *UDP_Channel_Init(tInterface *Interface) /** * \brief Read from the channel file (wait for a packet) */ -Uint64 UDP_Channel_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t UDP_Channel_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tUDPChannel *chan = Node->ImplPtr; tUDPPacket *pack; @@ -249,7 +249,7 @@ Uint64 UDP_Channel_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buf /** * \brief Write to the channel file (send a packet) */ -Uint64 UDP_Channel_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t UDP_Channel_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { tUDPChannel *chan = Node->ImplPtr; const tUDPEndpoint *ep; diff --git a/KernelLand/Modules/Input/PS2KbMouse/ps2mouse.c b/KernelLand/Modules/Input/PS2KbMouse/ps2mouse.c index 44be3b7b..69ce2b2e 100644 --- a/KernelLand/Modules/Input/PS2KbMouse/ps2mouse.c +++ b/KernelLand/Modules/Input/PS2KbMouse/ps2mouse.c @@ -19,8 +19,8 @@ int PS2Mouse_Install(char **Arguments); void PS2Mouse_HandleInterrupt(Uint8 InputByte); // - Filesystem - -Uint64 PS2Mouse_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -int PS2Mouse_IOCtl(tVFS_Node *Node, int ID, void *Data); +size_t PS2Mouse_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); + int PS2Mouse_IOCtl(tVFS_Node *Node, int ID, void *Data); // == GLOBALS == void (*gpMouse_EnableFcn)(void); @@ -150,7 +150,7 @@ void PS2Mouse_HandleInterrupt(Uint8 InputByte) /* Read mouse state (coordinates) */ -Uint64 PS2Mouse_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t PS2Mouse_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { if(Offset > sizeof(gMouse_FileData)) return 0; if(Length > sizeof(gMouse_FileData)) Length = sizeof(gMouse_FileData); diff --git a/KernelLand/Modules/Makefile.tpl b/KernelLand/Modules/Makefile.tpl index 0393b619..e2ef60a2 100644 --- a/KernelLand/Modules/Makefile.tpl +++ b/KernelLand/Modules/Makefile.tpl @@ -14,6 +14,7 @@ CPPFLAGS += -DARCH=$(ARCH) -DARCH_is_$(ARCH) -DARCHDIR_is_$(ARCHDIR) CPPFLAGS += $(_CPPFLAGS) CPPFLAGS += $(LIBINCLUDES) CFLAGS := -std=gnu99 -Wall -fno-stack-protector -g -O3 +CFLAGS += -Werror ifneq ($(CATEGORY),) FULLNAME := $(CATEGORY)_$(NAME) diff --git a/KernelLand/Modules/Network/NE2000/ne2000.c b/KernelLand/Modules/Network/NE2000/ne2000.c index d05b2a33..01f5f1fe 100644 --- a/KernelLand/Modules/Network/NE2000/ne2000.c +++ b/KernelLand/Modules/Network/NE2000/ne2000.c @@ -86,8 +86,8 @@ typedef struct sNe2k_Card { char *Ne2k_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *Ne2k_FindDir(tVFS_Node *Node, const char *Name); int Ne2k_IOCtl(tVFS_Node *Node, int ID, void *Data); -Uint64 Ne2k_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); -Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +size_t Ne2k_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); +size_t Ne2k_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); int Ne2k_int_ReadDMA(tCard *Card, int FirstPage, int NumPages, void *Buffer); Uint8 Ne2k_int_GetWritePage(tCard *Card, Uint16 Length); @@ -281,17 +281,16 @@ int Ne2k_IOCtl(tVFS_Node *Node, int ID, void *Data) } /** - * \fn Uint64 Ne2k_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) * \brief Send a packet from the network card */ -Uint64 Ne2k_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t Ne2k_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { tCard *Card = (tCard*)Node->ImplPtr; const Uint16 *buf = Buffer; int rem = Length; int page; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); + ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer); // TODO: Lock @@ -349,12 +348,11 @@ Uint64 Ne2k_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buf } /** - * \fn Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) * \brief Wait for and read a packet from the network card */ -Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Ne2k_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { - tCard *Card = (tCard*)Node->ImplPtr; + tCard *Card = Node->ImplPtr; Uint8 page; Uint8 data[256]; struct { @@ -363,7 +361,7 @@ Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) Uint16 Length; // Little Endian } *pktHdr; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); + ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer); // Wait for packets if( Semaphore_Wait( &Card->Semaphore, 1 ) != 1 ) diff --git a/KernelLand/Modules/Network/RTL8139/rtl8139.c b/KernelLand/Modules/Network/RTL8139/rtl8139.c index 1e9ac899..623be204 100644 --- a/KernelLand/Modules/Network/RTL8139/rtl8139.c +++ b/KernelLand/Modules/Network/RTL8139/rtl8139.c @@ -94,8 +94,8 @@ typedef struct sCard char *RTL8139_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *RTL8139_FindDir(tVFS_Node *Node, const char *Filename); int RTL8139_RootIOCtl(tVFS_Node *Node, int ID, void *Arg); -Uint64 RTL8139_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t RTL8139_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t RTL8139_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); int RTL8139_IOCtl(tVFS_Node *Node, int ID, void *Arg); void RTL8139_IRQHandler(int Num, void *Ptr); @@ -258,13 +258,13 @@ int RTL8139_RootIOCtl(tVFS_Node *Node, int ID, void *Data) } // --- File Functions --- -Uint64 RTL8139_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t RTL8139_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tCard *card = Node->ImplPtr; Uint16 read_ofs, pkt_length; int new_read_ofs; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); + ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer); retry: if( Semaphore_Wait( &card->ReadSemaphore, 1 ) != 1 ) @@ -313,7 +313,7 @@ retry: return Length; } -Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t RTL8139_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { int td; Uint32 status; diff --git a/KernelLand/Modules/Storage/ATA/main.c b/KernelLand/Modules/Storage/ATA/main.c index 41228d88..0f344a40 100644 --- a/KernelLand/Modules/Storage/ATA/main.c +++ b/KernelLand/Modules/Storage/ATA/main.c @@ -26,8 +26,8 @@ Uint16 ATA_GetBasePort(int Disk); // Filesystem Interface char *ATA_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *ATA_FindDir(tVFS_Node *Node, const char *Name); -Uint64 ATA_ReadFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 ATA_WriteFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t ATA_ReadFS(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); +size_t ATA_WriteFS(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); int ATA_IOCtl(tVFS_Node *Node, int Id, void *Data); // Read/Write Interface/Quantiser Uint ATA_ReadRaw(Uint64 Address, Uint Count, void *Buffer, Uint Disk); @@ -294,9 +294,9 @@ tVFS_Node *ATA_FindDir(tVFS_Node *UNUSED(Node), const char *Name) } /** - * \fn Uint64 ATA_ReadFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) + * \brief Read handler for VFS interface */ -Uint64 ATA_ReadFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t ATA_ReadFS(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { int disk = Node->Inode >> 8; int part = Node->Inode & 0xFF; @@ -335,9 +335,9 @@ Uint64 ATA_ReadFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) } /** - * \fn Uint64 ATA_WriteFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) + * \brief Write handler for VFS interface */ -Uint64 ATA_WriteFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t ATA_WriteFS(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { int disk = Node->Inode >> 8; int part = Node->Inode & 0xFF; diff --git a/KernelLand/Modules/Storage/FDDv2/main.c b/KernelLand/Modules/Storage/FDDv2/main.c index bec157ce..c33dcdad 100644 --- a/KernelLand/Modules/Storage/FDDv2/main.c +++ b/KernelLand/Modules/Storage/FDDv2/main.c @@ -24,7 +24,7 @@ char *FDD_ReadDir(tVFS_Node *Node, int pos); tVFS_Node *FDD_FindDir(tVFS_Node *dirNode, const char *Name); int FDD_IOCtl(tVFS_Node *Node, int ID, void *Data); -Uint64 FDD_ReadFS(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer); +size_t FDD_ReadFS(tVFS_Node *node, off_t Offset, size_t Len, void *buffer); // --- Helpers int FDD_int_ReadWriteWithinTrack(int Disk, int Track, int bWrite, size_t Offset, size_t Length, void *Buffer); @@ -169,14 +169,14 @@ int FDD_IOCtl(tVFS_Node *Node, int ID, void *Data) * \param Buffer Destination buffer * \return Number of bytes read */ -Uint64 FDD_ReadFS(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t FDD_ReadFS(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { int disk = Node->Inode; int track; int rem_len; char *dest = Buffer; - ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); + ENTER("pNode XOffset xLength pBuffer", Node, Offset, Length, Buffer); if( Offset > Node->Size ) LEAVE_RET('i', 0); if( Length > Node->Size ) Length = Node->Size; diff --git a/KernelLand/Modules/USB/HID/mouse.c b/KernelLand/Modules/USB/HID/mouse.c index 15946947..d590b32f 100644 --- a/KernelLand/Modules/USB/HID/mouse.c +++ b/KernelLand/Modules/USB/HID/mouse.c @@ -50,7 +50,7 @@ struct sHID_Mouse // === PROTOTYES === char *HID_Mouse_Root_ReadDir(tVFS_Node *Node, int Pos); tVFS_Node *HID_Mouse_Root_FindDir(tVFS_Node *Node, const char *Name); -Uint64 HID_Mouse_Dev_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +size_t HID_Mouse_Dev_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); int HID_Mouse_Dev_IOCtl(tVFS_Node *Node, int ID, void *Data); void HID_Mouse_Dev_Reference(tVFS_Node *Node); void HID_Mouse_Dev_Close(tVFS_Node *Node); @@ -122,7 +122,7 @@ tVFS_Node *HID_Mouse_Root_FindDir(tVFS_Node *Node, const char *Name) return &mouse->Node; } -Uint64 HID_Mouse_Dev_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t HID_Mouse_Dev_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) { tHID_Mouse *info = Node->ImplPtr; diff --git a/KernelLand/Modules/x86/VGAText/vga.c b/KernelLand/Modules/x86/VGAText/vga.c index 41f0bd01..cc8fda38 100644 --- a/KernelLand/Modules/x86/VGAText/vga.c +++ b/KernelLand/Modules/x86/VGAText/vga.c @@ -13,7 +13,7 @@ // === PROTOTYPES === int VGA_Install(char **Arguments); -Uint64 VGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); +size_t VGA_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); int VGA_IOCtl(tVFS_Node *Node, int Id, void *Data); Uint8 VGA_int_GetColourNibble(Uint16 col); Uint16 VGA_int_GetWord(const tVT_Char *Char); @@ -70,7 +70,7 @@ int VGA_Install(char **Arguments) /** * \brief Writes a string of bytes to the VGA controller */ -Uint64 VGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) +size_t VGA_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { if( giVGA_BufferFormat == VIDEO_BUFFMT_TEXT ) {