Kernel - Replaced for(;;); in panic with HALT_CPU macro
[tpg/acess2.git] / KernelLand / Kernel / vfs / fs / root.c
index 5685861..6aa9e28 100644 (file)
@@ -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 <acess.h>
 
 // === 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)

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