diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-08 09:28:31 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-08 09:28:31 +0200 |
| commit | 6f454424153fc205e519f7aada62837487600a8e (patch) | |
| tree | 9b7d753b7c87db6a8b81275247a5e31a90e98c5c /lib | |
| parent | 844968b28ffa805bfb5e3ade5b5537d716dca96e (diff) | |
refactor: New Embfs TeX specs, and reworked SNU-LIB's fix module.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/embdfs.hpp | 26 | ||||
| -rw-r--r-- | lib/fix/network.hpp | 5 | ||||
| -rw-r--r-- | lib/fix/parser.hpp | 28 |
3 files changed, 32 insertions, 27 deletions
diff --git a/lib/embdfs.hpp b/lib/embdfs.hpp index 9ec82d4..7beb1db 100644 --- a/lib/embdfs.hpp +++ b/lib/embdfs.hpp @@ -5,21 +5,21 @@ * Copyright 2025, Amlal El Mahrouss all rights reserved. */ -#ifndef _SNU_EMBDFS_HPP -#define _SNU_EMBDFS_HPP +#ifndef _SNU_EMBFS_HPP +#define _SNU_EMBFS_HPP #include <cstdint> #include <cstddef> -/// @brief A Filesystem designed for tiny storage medias. +/// @brief A filesystem designed for tiny storage medias. /// @author Amlal EL Mahrouss (founder@snu.systems) -namespace snu::embdfs +namespace snu::embfs { namespace details { - struct embdfs_superblock; - struct embdfs_inode; + struct embfs_superblock; + struct embfs_inode; inline constexpr const size_t _superblock_name_len = 16; inline constexpr const size_t _superblock_reserve_len = 462; @@ -27,9 +27,9 @@ namespace snu::embdfs inline constexpr const size_t _inode_arr_len = 12; inline constexpr const size_t _inode_lookup_len = 8; -#ifdef EMBDFS_28BIT_LBA +#ifdef EMBFS_28BIT_LBA typedef std::uint32_t lba_t; -#elif defined(EMBDFS_48BIT_LBA) +#elif defined(EMBFS_48BIT_LBA) typedef std::uint64_t lba_t; #endif @@ -39,7 +39,7 @@ namespace snu::embdfs typedef std::uint8_t utf8_char_t; /// @brief Superblock data structure - struct embdfs_superblock + struct embfs_superblock { sword_t s_block_mag; sdword_t s_num_inodes; @@ -60,7 +60,7 @@ namespace snu::embdfs /// @brief i_checksum crc32 checksum. /// @brief i_flags_perms flags and permissions /// @brief i_acl_* ACL to keep track of inode allocation status. - struct embdfs_inode + struct embfs_inode { utf8_char_t i_name[_inode_name_len]; sword_t i_size_virt, i_size_phys; @@ -70,8 +70,8 @@ namespace snu::embdfs }; /// @brief Indexed node linear array. - typedef embdfs_inode embdfs_inode_arr_t[_inode_arr_len]; + typedef embfs_inode embfs_inode_arr_t[_inode_arr_len]; } // namespace details -} // namespace snu::embdfs +} // namespace snu::embfs -#endif // ifndef _SNU_EMBDFS_HPP
\ No newline at end of file +#endif // ifndef _SNU_EMBFS_HPP
\ No newline at end of file diff --git a/lib/fix/network.hpp b/lib/fix/network.hpp index 0c167e5..95de49b 100644 --- a/lib/fix/network.hpp +++ b/lib/fix/network.hpp @@ -11,4 +11,9 @@ #include <arpa/inet.h> #include <sys/socket.h> +namespace snu::fix +{ + +} + #endif // ifndef _SNU_FIX_NETWORK_HPP
\ No newline at end of file diff --git a/lib/fix/parser.hpp b/lib/fix/parser.hpp index c20fe2f..edafc5a 100644 --- a/lib/fix/parser.hpp +++ b/lib/fix/parser.hpp @@ -17,21 +17,21 @@ namespace snu::fix { - struct fix_visitor; - struct fix_range; - struct fix_range_data; + struct visitor; + struct range; + struct range_data; /// @brief Buffer+Length structure - typedef fix_range* fix_range_ptr_t; + typedef range* range_ptr_t; - struct fix_range final + struct range final { char* ascii_bytes_; uint16_t length_; }; /// @brief Convert range to usable string. - inline std::string to_string(fix_range& range) noexcept + inline std::string to_string(range& range) noexcept { if (range.length_ < 0) return ""; @@ -39,7 +39,7 @@ namespace snu::fix return std::string(range.ascii_bytes_, range.length_); } - class fix_range_data final + class range_data final { public: std::string msg_magic_; @@ -47,21 +47,21 @@ namespace snu::fix std::vector<std::pair<std::string, std::string>> msg_body_; }; - class fix_visitor final + class visitor final { public: static constexpr auto soh = '|'; static constexpr auto base = 10U; - explicit fix_visitor() = default; - ~fix_visitor() = default; + explicit visitor() = default; + ~visitor() = default; - fix_visitor& operator=(const fix_visitor&) = default; - fix_visitor(const fix_visitor&) = default; + visitor& operator=(const visitor&) = default; + visitor(const visitor&) = default; - fix_range_data visit(const std::string& in) + range_data visit(const std::string& in) { - fix_range_data ret{}; + range_data ret{}; std::string in_tmp; |
