fs: provide access to DT-defined mount structures
Use a devicetree fstab entry node identifier to provide a unique identifier for a fs_mount_t structure that is defined with everything necessary to mount the file system associated with a partition. The fs_mount_t structure will be defined in the implementation for each file system type. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
0ea3272c2f
commit
4080b7727f
2 changed files with 28 additions and 13 deletions
|
@ -79,19 +79,6 @@ extern "C" {
|
|||
(DT_PARENT(DT_GPARENT(node_id))), \
|
||||
(DT_GPARENT(node_id)))
|
||||
|
||||
/*
|
||||
* @brief Get the common mount flags for an fstab entry.
|
||||
|
||||
* @param node_id the node identifier for a child entry in a
|
||||
* zephyr,fstab node.
|
||||
* @return a value suitable for initializing an fs_mount_t flags
|
||||
* member.
|
||||
*/
|
||||
#define DT_FSTAB_ENTRY_MOUNT_FLAGS(node_id) \
|
||||
((DT_PROP(node_id, automount) ? FS_MOUNT_FLAG_AUTOMOUNT : 0) \
|
||||
| (DT_PROP(node_id, read_only) ? FS_MOUNT_FLAG_READ_ONLY : 0) \
|
||||
| (DT_PROP(node_id, no_format) ? FS_MOUNT_FLAG_NO_FORMAT : 0))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -192,6 +192,34 @@ struct fs_statvfs {
|
|||
* @}
|
||||
*/
|
||||
|
||||
/*
|
||||
* @brief Get the common mount flags for an fstab entry.
|
||||
|
||||
* @param node_id the node identifier for a child entry in a
|
||||
* zephyr,fstab node.
|
||||
* @return a value suitable for initializing an fs_mount_t flags
|
||||
* member.
|
||||
*/
|
||||
#define FSTAB_ENTRY_DT_MOUNT_FLAGS(node_id) \
|
||||
((DT_PROP(node_id, automount) ? FS_MOUNT_FLAG_AUTOMOUNT : 0) \
|
||||
| (DT_PROP(node_id, read_only) ? FS_MOUNT_FLAG_READ_ONLY : 0) \
|
||||
| (DT_PROP(node_id, no_format) ? FS_MOUNT_FLAG_NO_FORMAT : 0))
|
||||
|
||||
/**
|
||||
* @brief The name under which a zephyr,fstab entry mount structure is
|
||||
* defined.
|
||||
*/
|
||||
#define FS_FSTAB_ENTRY(node_id) _CONCAT(z_fsmp_, node_id)
|
||||
|
||||
/**
|
||||
* @brief Generate a declaration for the externally defined fstab
|
||||
* entry.
|
||||
*
|
||||
* This will evaluate to the name of a struct fs_mount_t object.
|
||||
*/
|
||||
#define FS_FSTAB_DECLARE_ENTRY(node_id) \
|
||||
extern struct fs_mount_t FS_FSTAB_ENTRY(node_id)
|
||||
|
||||
/**
|
||||
* @brief Open or create file
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue