X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Finclude%2Fvfs.h;h=f7666137bbdb21db53ed485bcd64423d0f9226b1;hb=5d4bf69e4eaab0f080fc04e318b48249ccaba398;hp=59824e23907f0fe87b6584a43d1a4223c03fe661;hpb=d0b4559f2936f6d9f06be0f7c3c51527a480ec0d;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/include/vfs.h b/KernelLand/Kernel/include/vfs.h index 59824e23..f7666137 100644 --- a/KernelLand/Kernel/include/vfs.h +++ b/KernelLand/Kernel/include/vfs.h @@ -194,6 +194,28 @@ typedef struct sVFS_Node */ } tVFS_Node; +/** + * \name tVFS_NodeType.FindDir Flags + * \brief + * \{ + */ +//\! Attempt non-blocking IO +#define VFS_IOFLAG_NOBLOCK 0x001 +/** + * \} + */ + +/** + * \name tVFS_NodeType.FindDir Flags + * \brief + * \{ + */ +//\! Call was triggered by VFS_Stat (as opposed to open) +#define VFS_FDIRFLAG_STAT 0x001 +/** + * \} + */ + /** * \brief Functions for a specific node type */ @@ -251,7 +273,7 @@ struct sVFS_NodeType * \param Buffer Destination for read data * \return Number of bytes read */ - size_t (*Read)(struct sVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); + size_t (*Read)(struct sVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags); /** * \brief Write to the file * \param Node Pointer to this node @@ -260,7 +282,7 @@ struct sVFS_NodeType * \param Buffer Source of written data * \return Number of bytes read */ - size_t (*Write)(struct sVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); + size_t (*Write)(struct sVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer, Uint Flags); /** * \brief Map a region of a file into memory @@ -286,10 +308,10 @@ struct sVFS_NodeType * \param Node Pointer to this node * \param Name Name of the file wanted * \return Pointer to the requested node or NULL if it cannot be found - * \note The node returned must be accessable until ::tVFS_Node.Close + * \note The node returned must be accessable until tVFS_NodeType::Close * is called and ReferenceCount reaches zero. */ - struct sVFS_Node *(*FindDir)(struct sVFS_Node *Node, const char *Name); + struct sVFS_Node *(*FindDir)(struct sVFS_Node *Node, const char *Name, Uint Flags); /** * \brief Read from a directory @@ -307,7 +329,7 @@ struct sVFS_NodeType * \param Flags Flags to apply to the new child (directory or symlink) * \return Created node or NULL on error */ - tVFS_Node *(*MkNod)(struct sVFS_Node *Node, const char *Name, Uint Flags); + tVFS_Node *(*MkNod)(struct sVFS_Node *Node, const char *Name, Uint Mode); /** * \brief Relink (Rename/Remove) a file/directory @@ -322,7 +344,7 @@ struct sVFS_NodeType * \param Node Pointer to this node (directory) * \param NewName Name for the new link * \param Child Node to create a new link to - * \retur Zeron on success, non-zero on error (see errno.h) + * \return Zero on success, non-zero on error (see errno.h) */ int (*Link)(struct sVFS_Node *Node, const char *NewName, struct sVFS_Node *Child); @@ -474,12 +496,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 @@ -487,7 +514,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 @@ -495,7 +522,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 @@ -503,13 +531,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); /** * \}