diff --git a/include/devicetree/fixed-partitions.h b/include/devicetree/fixed-partitions.h index 5d1956e0ce1..4eeb31055c5 100644 --- a/include/devicetree/fixed-partitions.h +++ b/include/devicetree/fixed-partitions.h @@ -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)) - /** * @} */ diff --git a/include/fs/fs.h b/include/fs/fs.h index b0dd027e6aa..7aef7c78d38 100644 --- a/include/fs/fs.h +++ b/include/fs/fs.h @@ -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 *