From b6c4947a2c87a1adc1d76c39aebe9a6e5adb27f8 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 2 Apr 2025 20:59:12 +0200 Subject: embdfs.hpp: got an overall idea of the design. Signed-off-by: Amlal El Mahrouss --- compile_flags.txt | 3 ++- lib/astdx/embdfs.hpp | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/compile_flags.txt b/compile_flags.txt index bd5b51a..e6f2dcc 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -1,2 +1,3 @@ -Ilib --std=c++20 \ No newline at end of file +-std=c++20 +-DEMBDFS_28BIT_LBA \ No newline at end of file diff --git a/lib/astdx/embdfs.hpp b/lib/astdx/embdfs.hpp index f873b7d..b2c4b12 100644 --- a/lib/astdx/embdfs.hpp +++ b/lib/astdx/embdfs.hpp @@ -22,28 +22,46 @@ namespace astdx::freestanding struct embdfs_superblock; struct embdfs_inode; - inline constexpr const size_t g_superblock_name_len_ = 16; + inline constexpr const size_t _superblock_name_len = 16; + +#ifdef EMBDFS_28BIT_LBA + typedef std::uint32_t lba_t; +#elif defined(EMBDFS_48BIT_LBA) + typedef std::uint64_t lba_t; +#endif + + typedef std::int16_t sword_t; + typedef std::int32_t sdword_t; + + typedef std::uint8_t utf8_char_t; /// @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_]; + sword_t s_block_mag; + sdword_t s_num_inodes; + sdword_t s_part_size; + sdword_t s_part_used; + sword_t s_sector_sz; + lba_t s_inode_start; + lba_t s_inode_end; + utf8_char_t s_name[_superblock_name_len]; }; } // namespace details /// @brief Creates the library context. /// @return Whether it suceeded or not. - int32_t embdfs_create_context(); + inline int32_t embdfs_create_context() + { + return 0; + } /// @brief Destroys the library context. /// @return Whether it suceeded or not. - int32_t embdfs_destroy_context(); + inline int32_t embdfs_destroy_context() + { + return 0; + } } // namespace astdx::freestanding #endif // ifndef _STDX_EMBDFS_HPP \ No newline at end of file -- cgit v1.2.3 From 7d92c75a1f1e29b9161c65ce11d95dfafb422fd4 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 2 Apr 2025 21:04:29 +0200 Subject: embdfs.hpp: got the superblock right. Signed-off-by: Amlal El Mahrouss --- lib/astdx/embdfs.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/astdx/embdfs.hpp b/lib/astdx/embdfs.hpp index b2c4b12..6b018cf 100644 --- a/lib/astdx/embdfs.hpp +++ b/lib/astdx/embdfs.hpp @@ -22,7 +22,8 @@ namespace astdx::freestanding struct embdfs_superblock; struct embdfs_inode; - inline constexpr const size_t _superblock_name_len = 16; + inline constexpr const size_t _superblock_name_len = 16; + inline constexpr const size_t _superblock_reserve_len = 462; #ifdef EMBDFS_28BIT_LBA typedef std::uint32_t lba_t; @@ -42,10 +43,12 @@ namespace astdx::freestanding sdword_t s_num_inodes; sdword_t s_part_size; sdword_t s_part_used; + sdword_t s_version; sword_t s_sector_sz; lba_t s_inode_start; lba_t s_inode_end; utf8_char_t s_name[_superblock_name_len]; + utf8_char_t s_reserved[_superblock_reserve_len]; }; } // namespace details -- cgit v1.2.3