summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-02 21:05:06 +0200
committerGitHub <noreply@github.com>2025-04-02 21:05:06 +0200
commit6dd868e57f32905e5e553f6e3ed5ef35ae5cae77 (patch)
tree6fe2009791c3f159c900d634afa6e83380384655
parentf85c4ecaea1efe3591ea3eb340a3d3468c71d98b (diff)
parent7d92c75a1f1e29b9161c65ce11d95dfafb422fd4 (diff)
Merge pull request #1 from amlel-el-mahrouss/dev
dev: got superblock design for embdfs.
-rw-r--r--compile_flags.txt3
-rw-r--r--lib/astdx/embdfs.hpp41
2 files changed, 33 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..6b018cf 100644
--- a/lib/astdx/embdfs.hpp
+++ b/lib/astdx/embdfs.hpp
@@ -22,28 +22,49 @@ 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;
+ inline constexpr const size_t _superblock_reserve_len = 462;
+
+#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;
+ 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
/// @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