summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-03-31 08:04:00 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-03-31 08:04:00 +0200
commitead0208da5bc3c4fe46788dc4321bfb5bd536822 (patch)
tree1de3c781068eef6b1ab2389180379d6570341cc0 /lib
parent0c6a9b85c3b217c70bc83c7e049e0c5dd39c717c (diff)
mod/embdfs: got a basic idea of how the library's gonna look like and
work. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/stdx/embdfs.hpp41
1 files changed, 27 insertions, 14 deletions
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 <cstdint>
#include <cstddef>
-/// @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