From fbbc3456663f800eff9e047f26fd64874c4aa152 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 31 Mar 2025 07:09:23 +0200 Subject: mod/embdfs.hpp: add superblock structure. Signed-off-by: Amlal El Mahrouss --- format.sh | 10 ++++++++++ lib/stdx/cgi.hpp | 8 ++++---- lib/stdx/embdfs.hpp | 20 ++++++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100755 format.sh diff --git a/format.sh b/format.sh new file mode 100755 index 0000000..28928f2 --- /dev/null +++ b/format.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +THIS_PATH="$(realpath "$0")" +THIS_DIR="$(dirname "$THIS_PATH")" + +FILE_LIST="$(find "$THIS_DIR" | grep -E ".*(\.cpp|\.c|\.hpp|\.inl)$")" + +echo -e "Files found to format = \n\"\"\"\n$FILE_LIST\n\"\"\"" + +clang-format --verbose -i --style=file $FILE_LIST diff --git a/lib/stdx/cgi.hpp b/lib/stdx/cgi.hpp index 6d50994..5213c15 100644 --- a/lib/stdx/cgi.hpp +++ b/lib/stdx/cgi.hpp @@ -30,12 +30,12 @@ namespace stdx public: explicit cgi_writer() = default; - ~cgi_writer() = default; + ~cgi_writer() = default; - cgi_writer& operator=(const cgi_writer&) = default; - cgi_writer(const cgi_writer&) = default; + cgi_writer& operator=(const cgi_writer&) = default; + cgi_writer(const cgi_writer&) = default; - public: + public: cgi_writer& eval_html(const std::stringstream& ss_html) { return this->eval_("text/html", ss_html); diff --git a/lib/stdx/embdfs.hpp b/lib/stdx/embdfs.hpp index 05e2fc9..5cc8496 100644 --- a/lib/stdx/embdfs.hpp +++ b/lib/stdx/embdfs.hpp @@ -12,13 +12,25 @@ #include #include -/// @brief A Fail-safe filesystem designed for tiny MCUs. +/// @brief A Filesystem designed for tiny storage. /// @author Amlal EL Mahrouss (amlal@nekernel.org) namespace stdx::freestanding { - struct embdfs_superblock; - struct embdfs_inode; -} + struct embdfs_superblock; + struct embdfs_inode; + + /// @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[16]; + }; +} // namespace stdx::freestanding #endif // ifndef _STDX_EMBDFS_HPP \ No newline at end of file -- cgit v1.2.3