Kernel/IPStack - (minor) TODO retransmit timer
[tpg/acess2.git] / KernelLand / Kernel / include / vfs.h
index 82e6b56..b030627 100644 (file)
@@ -216,6 +216,21 @@ typedef struct sVFS_Node
  * \}
  */
 
+/**
+ * \name tVFS_NodeType.Type flags
+ * \brief Flags for node types
+ * \{
+ */
+//\! Calls to VFS_Write should not generate calls to .Trunctate
+//\! 
+//\! If this flag is set, writing over the end of the file will not call .Truncate automatically
+#define VFS_NODETYPEFLAG_NOAUTOEXPAND  0x001
+//\! Node type describes a stream (offset ignored, seeking disallowed)
+#define VFS_NODETYPEFLAG_STREAM        0x002
+/**
+ * \}
+ */
+
 /**
  * \brief Functions for a specific node type
  */
@@ -226,6 +241,11 @@ struct sVFS_NodeType
         */
        const char      *TypeName;
 
+       /**
+        * \brief Flags describing operational quirks
+        */
+       unsigned int    Flags;
+
        /**
         * \name Common Functions
         * \brief Functions that are used no matter the value of .Flags
@@ -293,7 +313,18 @@ struct sVFS_NodeType
         * \return Boolean Failure
         * \note If NULL, the VFS implements it using .Read
         */
-        int    (*MMap)(struct sVFS_Node *Node, off_t Offset, int Length, void *Dest);
+        int    (*MMap)(struct sVFS_Node *Node, off_t Offset, size_t Length, void *Dest);
+       
+       /**
+        * \brief Resize a file
+        * \param Node  Pointer to this node
+        * \param NewSize       New file size
+        * \return Actual new file size
+        * \note If NULL, \a Write may be called with Offset + Length > Size
+        *
+        * Called to increase/decrease the size of a file. If the 
+        */
+       off_t   (*Truncate)(struct sVFS_Node *Node, off_t NewSize);
        
        /**
         * \}
@@ -469,7 +500,7 @@ extern tVFS_ACL     *VFS_UnixToAcessACL(Uint Mode, Uint Owner, Uint Group);
  * \param Type Type of wait
  * \param Timeout      Time to wait (NULL for infinite wait)
  * \param Name Name to show in debug output
- * \return Number of nodes that actioned (0 or 1)
+ * \return Bitset of Type flags that applied
  */
 extern int     VFS_SelectNode(tVFS_Node *Node, int Type, tTime *Timeout, const char *Name);
 
@@ -496,12 +527,17 @@ extern int        VFS_MarkError(tVFS_Node *Node, BOOL IsErrorState);
  * fast cleanup when a filesystem is unmounted.
  * \{
  */
+
+typedef struct sInodeCache     tInodeCache;
+
+typedef void   (*tInode_CleanUpNode)(tVFS_Node *Node);
+
 /**
  * \fn int Inode_GetHandle(void)
  * \brief Gets a unique handle to the Node Cache
  * \return A unique handle for use for the rest of the Inode_* functions
  */
-extern int     Inode_GetHandle(void);
+extern tInodeCache     *Inode_GetHandle(tInode_CleanUpNode CleanUpNode);
 /**
  * \fn tVFS_Node *Inode_GetCache(int Handle, Uint64 Inode)
  * \brief Gets an inode from the node cache
@@ -509,7 +545,7 @@ extern int  Inode_GetHandle(void);
  * \param Inode        Value of the Inode field of the ::tVFS_Node you want
  * \return A pointer to the cached node
  */
-extern tVFS_Node       *Inode_GetCache(int Handle, Uint64 Inode);
+extern tVFS_Node       *Inode_GetCache(tInodeCache *Handle, Uint64 Inode);
 /**
  * \fn tVFS_Node *Inode_CacheNode(int Handle, tVFS_Node *Node)
  * \brief Caches a node in the Node Cache
@@ -517,7 +553,8 @@ extern tVFS_Node    *Inode_GetCache(int Handle, Uint64 Inode);
  * \param Node A pointer to the node to be cached (a copy is taken)
  * \return A pointer to the node in the node cache
  */
-extern tVFS_Node       *Inode_CacheNode(int Handle, tVFS_Node *Node);
+extern tVFS_Node       *Inode_CacheNode(tInodeCache *Handle, tVFS_Node *Node);
+extern tVFS_Node       *Inode_CacheNodeEx(tInodeCache *Handle, tVFS_Node *Node, size_t Size);
 /**
  * \fn int Inode_UncacheNode(int Handle, Uint64 Inode)
  * \brief Dereferences (and removes if needed) a node from the cache
@@ -525,13 +562,13 @@ extern tVFS_Node  *Inode_CacheNode(int Handle, tVFS_Node *Node);
  * \param Inode        Value of the Inode field of the ::tVFS_Node you want to remove
  * \return -1: Error (not present), 0: Not freed, 1: Freed
  */
-extern int     Inode_UncacheNode(int Handle, Uint64 Inode);
+extern int     Inode_UncacheNode(tInodeCache *Handle, Uint64 Inode);
 /**
  * \fn void Inode_ClearCache(int Handle)
  * \brief Clears the cache for a handle
  * \param Handle       A handle returned by Inode_GetHandle()
  */
-extern void    Inode_ClearCache(int Handle);
+extern void    Inode_ClearCache(tInodeCache *Handle);
 
 /**
  * \}

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