From ead0208da5bc3c4fe46788dc4321bfb5bd536822 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 31 Mar 2025 08:04:00 +0200 Subject: mod/embdfs: got a basic idea of how the library's gonna look like and work. Signed-off-by: Amlal El Mahrouss --- lib/stdx/embdfs.hpp | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'lib/stdx') diff --git a/lib/stdx/embdfs.hpp b/lib/stdx/embdfs.hpp index 5cc8496..baca491 100644 --- a/lib/stdx/embdfs.hpp +++ b/lib/stdx/embdfs.hpp @@ -12,25 +12,38 @@ #include #include -/// @brief A Filesystem designed for tiny storage. +/// @brief A Filesystem designed for tiny storage medias. /// @author Amlal EL Mahrouss (amlal@nekernel.org) namespace stdx::freestanding { - struct embdfs_superblock; - struct embdfs_inode; - - /// @brief Superblock data structure - struct embdfs_superblock + namespace details { - std::int16_t s_block_mag; - std::int32_t s_num_inodes; - std::int32_t s_part_size; - std::int32_t s_part_used; - std::int16_t s_sector_sz; - std::uint32_t s_inode_start, s_inode_end; - char s_name[16]; - }; + struct embdfs_superblock; + struct embdfs_inode; + + inline constexpr const size_t g_superblock_name_len_ = 16; + + /// @brief Superblock data structure + struct embdfs_superblock + { + std::int16_t s_block_mag; + std::int32_t s_num_inodes; + std::int32_t s_part_size; + std::int32_t s_part_used; + std::int16_t s_sector_sz; + std::uint32_t s_inode_start, s_inode_end; + char s_name[g_superblock_name_len_]; + }; + } // namespace details + + /// @brief Creates the library context. + /// @return Whether it suceeded or not. + int32_t embdfs_create_context(); + + /// @brief Destroys the library context. + /// @return Whether it suceeded or not. + int32_t embdfs_destroy_context(); } // namespace stdx::freestanding #endif // ifndef _STDX_EMBDFS_HPP \ No newline at end of file -- cgit v1.2.3