X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fvfs%2Ffs%2Froot.c;h=6aa9e28d98f7fa73463167a3fac7ce383f69350e;hb=6b5fe5c5491e925bb1dd0d0650eeafd363538b1a;hp=56858617d61733c586588730be1b06f98fb37393;hpb=e4342ad9de52043cb8f820643794dc44076f9bd9;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/vfs/fs/root.c b/KernelLand/Kernel/vfs/fs/root.c index 56858617..6aa9e28d 100644 --- a/KernelLand/Kernel/vfs/fs/root.c +++ b/KernelLand/Kernel/vfs/fs/root.c @@ -1,6 +1,11 @@ /* - * AcessMicro VFS + * Acess2 Kernel + * - By John Hodge (thePowersGang) + * + * vfs/fs/root.c * - Root Filesystem Driver + * + * TODO: Restrict to directories+symlinks only */ #define DEBUG 0 #include @@ -9,15 +14,15 @@ // === CONSTANTS === #define MAX_FILES 64 -#define MAX_FILE_SIZE 1024 +#define MAX_FILE_SIZE 10*1024*1024 // === PROTOTYPES === tVFS_Node *Root_InitDevice(const char *Device, const char **Options); tVFS_Node *Root_MkNod(tVFS_Node *Node, const char *Name, Uint Flags); -tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name); +tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name, Uint Flags); int Root_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]); -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); +size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags); +size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer, Uint Flags); tRamFS_File *Root_int_AllocFile(void); // === GLOBALS === @@ -149,7 +154,7 @@ tVFS_Node *Root_MkNod(tVFS_Node *Node, const char *Name, Uint Flags) * \fn tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name) * \brief Find an entry in the filesystem */ -tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name) +tVFS_Node *Root_FindDir(tVFS_Node *Node, const char *Name, Uint Flags) { tRamFS_File *parent = Node->ImplPtr; tRamFS_File *child = parent->Data.FirstChild; @@ -192,7 +197,7 @@ int Root_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]) /** * \brief Read from a file in the root directory */ -size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) +size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags) { tRamFS_File *file = Node->ImplPtr; @@ -211,7 +216,7 @@ size_t Root_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) /** * \brief Write to a file in the root directory */ -size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) +size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer, Uint Flags) { tRamFS_File *file = Node->ImplPtr; @@ -225,9 +230,10 @@ size_t Root_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buff if(Offset + Length > MAX_FILE_SIZE) { Length = MAX_FILE_SIZE - Offset; + ASSERTC(Length, <=, MAX_FILE_SIZE); } - LOG("Buffer = '%.*s'", (int)Length, Buffer); + LOG("Length = %x", Length); // Check if buffer needs to be expanded if(Offset + Length > Node->Size)