From 6a9ebbeb6244e70204dc435d77910abc83e5ddeb Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 20 Nov 2021 13:39:18 +0000 Subject: [PATCH] Mode details about nodes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15119 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/vfs/include/vfsnodes.h | 46 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/os/vfs/include/vfsnodes.h b/os/vfs/include/vfsnodes.h index 9a177614a..3f4daa374 100644 --- a/os/vfs/include/vfsnodes.h +++ b/os/vfs/include/vfsnodes.h @@ -32,6 +32,17 @@ /* Module constants. */ /*===========================================================================*/ +/** + * @name Node attributes. + * @{ + */ +#define VFS_NODE_ATTR_READONLY 1U +#define VFS_NODE_ATTR_RESERVED2 2U +#define VFS_NODE_ATTR_SYSTEM 4U +#define VFS_NODE_ATTR_RESERVED8 8U +#define VFS_NODE_ATTR_ISDIR 16U +/** @} */ + /*===========================================================================*/ /* Module pre-compile time settings. */ /*===========================================================================*/ @@ -47,6 +58,35 @@ /* Forward declaration because nodes holds references to drivers.*/ typedef struct vfs_driver vfs_driver_t; +/** + * @brief Type of a file offset. + */ +typedef uint32_t vfs_fileoffset_t; + +/** + * @brief Type of a node attributes. + */ +typedef uint32_t vfs_nodeattr_t; + +/** + * @brief Type of a node information structure. + * @todo Add attributes, permissions etc. + */ +typedef struct vfs_node_info { + /** + * @brief Size of the node. + */ + vfs_nodeattr_t attr; + /** + * @brief Size of the node. + */ + vfs_fileoffset_t size; + /** + * @brief Name of the node. + */ + char name[VFS_CFG_MAX_NAMELEN + 1]; +} vfs_node_info_t; + /** * @brief @p vfs_node_t specific methods. */ @@ -54,7 +94,7 @@ typedef struct vfs_driver vfs_driver_t; /* Instance offset, used for multiple inheritance, normally zero. It represents the offset between the current object and the container object*/ \ - size_t instance_offset; \ + size_t instance_offset; \ /* Node release, the object is disposed when the counter reaches zero.*/ \ void (*release)(void *instance); @@ -119,7 +159,9 @@ typedef struct vfs_directory_node { * @brief @p vfs_file_node_t specific methods. */ #define __vfs_file_node_methods \ - __vfs_node_methods + __vfs_node_methods \ + bool (*first)(vfs_node_info_t *nif); \ + bool (*next)(vfs_node_info_t *nif); /** * @brief @p vfs_file_node_t specific data.