Kernel/VFS - Truncate support, mmap fixes
[tpg/acess2.git] / KernelLand / Kernel / include / vfs.h
index 4be24c3..72c6cbd 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
@@ -295,6 +315,17 @@ struct sVFS_NodeType
         */
         int    (*MMap)(struct sVFS_Node *Node, off_t Offset, int 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);
+       
        /**
         * \}
         */

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