X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Finclude%2Fvfs.h;h=59824e23907f0fe87b6584a43d1a4223c03fe661;hb=e07265fe604b8865df0e8c5e4503be3682d9b637;hp=0977e28cb248b81e48788a44ae9d3c5e19562e27;hpb=dfa46953df4e4c3717fb0fb216b144a787dcde59;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/include/vfs.h b/KernelLand/Kernel/include/vfs.h index 0977e28c..59824e23 100644 --- a/KernelLand/Kernel/include/vfs.h +++ b/KernelLand/Kernel/include/vfs.h @@ -20,6 +20,7 @@ #define _VFS_H #include +#include /** * \brief Thread list datatype for VFS_Select @@ -77,7 +78,15 @@ typedef struct sVFS_NodeType tVFS_NodeType; * is unmapped. Nice for read-only files and memory-only files (or * pseudo-readonly filesystems) */ -#define VFS_FFLAG_NOWRITEBACK +#define VFS_FFLAG_NOWRITEBACK 0x1000 + +/** + * \brief "Dirty Metadata" Flag + * + * Indicates that the node's metadata has been altered since the flag was last + * cleared. Tells the driver that it should update the inode at the next flush. + */ +#define VFS_FFLAG_DIRTY 0x8000 /** * \} */ @@ -90,6 +99,11 @@ typedef struct sVFS_NodeType tVFS_NodeType; */ typedef struct sVFS_Node { + /** + * \brief Functions associated with the node + */ + tVFS_NodeType *Type; + /** * \name Identifiers * \brief Fields used by the driver to identify what data this node @@ -178,11 +192,6 @@ typedef struct sVFS_Node /** * \} */ - - /** - * \brief Functions associated with the node - */ - tVFS_NodeType *Type; } tVFS_Node; /** @@ -286,22 +295,19 @@ struct sVFS_NodeType * \brief Read from a directory * \param Node Pointer to this node * \param Pos Offset in the directory - * \return Pointer to the name of the item on the heap (will be freed - * by the caller). If the directory end has been reached, NULL - * will be returned. - * If an item is required to be skipped either &::NULLNode, - * ::VFS_SKIP or ::VFS_SKIPN(0...1023) will be returned. + * \param Dest Destination for filename + * \return Zero on success, negative on error or +ve for ignore entry */ - char *(*ReadDir)(struct sVFS_Node *Node, int Pos); + int (*ReadDir)(struct sVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]); /** * \brief Create a node in a directory * \param Node Pointer to this node * \param Name Name of the new child * \param Flags Flags to apply to the new child (directory or symlink) - * \return Zero on Success, non-zero on error (see errno.h) + * \return Created node or NULL on error */ - int (*MkNod)(struct sVFS_Node *Node, const char *Name, Uint Flags); + tVFS_Node *(*MkNod)(struct sVFS_Node *Node, const char *Name, Uint Flags); /** * \brief Relink (Rename/Remove) a file/directory @@ -339,6 +345,15 @@ typedef struct sVFS_Driver */ Uint Flags; + /** + * \brief Detect if a volume is accessible using this driver + * \return Boolean success (with higher numbers being higher priority) + * + * E.g. FAT would return 1 as it's the lowest common denominator while ext2 might return 2, + * because it can be embedded in a FAT volume (and is a more fully featured filesystem). + */ + int (*Detect)(int FD); + /** * \brief Callback to mount a device */