diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2016-12-24 15:55:56 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2016-12-24 15:55:56 +0100 |
| commit | d6c74fdea16c70a93c70449317d75c5445c7522e (patch) | |
| tree | 2f801a3ea8fe49b21fd99836edd77ce2d0f26924 /include/fs/detail | |
| parent | 9b02e03c2a6f8a74a83dd40c69719fe36f4dd154 (diff) | |
| download | extfs-d6c74fdea16c70a93c70449317d75c5445c7522e.tar.xz extfs-d6c74fdea16c70a93c70449317d75c5445c7522e.zip | |
Update documentation
Diffstat (limited to 'include/fs/detail')
| -rw-r--r-- | include/fs/detail/superblock.hpp | 119 | ||||
| -rw-r--r-- | include/fs/detail/types.hpp | 42 |
2 files changed, 97 insertions, 64 deletions
diff --git a/include/fs/detail/superblock.hpp b/include/fs/detail/superblock.hpp index 5b7a4ca..f86fe3d 100644 --- a/include/fs/detail/superblock.hpp +++ b/include/fs/detail/superblock.hpp @@ -1,78 +1,69 @@ #ifndef EXTFS_SUPERBLOCK_HPP #define EXTFS_SUPERBLOCK_HPP +#include "fs/detail/types.hpp" + #include <array> #include <cstdint> namespace fs::detail { - using u32 = std::uint32_t; - using s32 = std::int32_t; - using u16 = std::uint16_t; - using s16 = std::uint16_t; - using u08 = std::uint8_t; - - template<std::size_t Size> - using chr_arr = std::array<char, Size>; - - template<std::size_t Size> - using u08_arr = std::array<u08, Size>; - - template<std::size_t Size> - using u32_arr = std::array<u32, Size>; - - + /** + * This structure describes the ext2/3/4 superblock + * + * @since 1.0 + */ struct extfs_superblock { - u32 const inodes_count{}; - u32 const blocks_count{}; - u32 const reserved_blocks_count{}; - u32 const free_blocks_count{}; - u32 const free_inodes_count{}; - u32 const first_data_block_id{}; - u32 const logical_block_size{}; - s32 const logical_fragment_size{}; - u32 const blocks_per_group{}; - u32 const fragments_per_group{}; - u32 const inodes_per_group{}; - u32 const last_mount_timestamp{}; - u32 const last_write_timestamp{}; - u16 const mount_count{}; - u16 const maximum_mount_count{}; - u16 const magic_number{}; - s16 const state{}; - s16 const error_behaviour{}; - s16 const revision_level_minor{}; - u32 const last_check_timestamp{}; - u32 const check_interval{}; - u32 const creator_operating_system_id{}; - u32 const revision_level{}; - u16 const super_user_id{}; - u16 const super_user_group_id{}; - u32 const first_inode_id{}; - u16 const inode_size{}; - u16 const superblock_group_id{}; - u32 const compatible_features{}; - u32 const incompatible_features{}; - u32 const read_only_compatible_features{}; - u08_arr<16> const uuid{}; - chr_arr<16> const volume_name{}; - chr_arr<64> const last_mount_point{}; - u32 const compression_algorithm{}; - u08 const file_preallocated_blocks_count{}; - u08 const directory_preallocated_blocks_count{}; - u16 const _padding{}; - u08_arr<16> const journal_superblock_uuid{}; - u32 const journal_inode_id{}; - u32 const journal_device_number{}; - u32 const last_orphan_inode_id{}; - u32_arr<4> const hash_seed{}; - u08 const hash_version{}; - u08_arr<3> const _reserved0{}; - u32 const default_mount_options{}; - u32 const first_meta_block_group_id{}; - u08_arr<760> const _reserved1{}; + u32 const inodes_count{}; ///< The total number of inodes in the file system + u32 const blocks_count{}; ///< The total number of blocks in the file system + u32 const reserved_blocks_count{}; ///< The number of blocks reserved for the super user + u32 const free_blocks_count{}; ///< The number of free blocks in the file system + u32 const free_inodes_count{}; ///< The mumber of free inodes in the file system + u32 const first_data_block_id{}; ///< The first block that carries user data in the file system + u32 const logical_block_size{}; ///< The logical size of a block (1024 << logical_block_size) + s32 const logical_fragment_size{}; ///< The logical size of a block (1024 << logical_fragment_size) + u32 const blocks_per_group{}; ///< The number of blocks per block group + u32 const fragments_per_group{}; ///< The number of fragments per block group + u32 const inodes_per_group{}; ///< The number of inodes per block group + u32 const last_mount_timestamp{}; ///< The unix timestamp when the file system was last mounted + u32 const last_write_timestamp{}; ///< The unix timestamp of the last write operation to the file system + u16 const mount_count{}; ///< The number of times the file system was mounted since the last check + u16 const maximum_mount_count{}; ///< The maximum number of times the file system can be mounted until a full check + u16 const magic_number{}; ///< The magic number identifying the file system type + s16 const state{}; ///< The state of the file system + s16 const error_behaviour{}; ///< The desired behaviour if a file system error occurs + s16 const revision_level_minor{}; ///< The minor revision level of the file system + u32 const last_check_timestamp{}; ///< The unix timestamp of the last check of the file system + u32 const check_interval{}; ///< The unix time interval in which to check the file system + u32 const creator_operating_system_id{}; ///< The operation system identifier of the OS that created the file system + u32 const revision_level{}; ///< The revision level of the file system + u16 const super_user_id{}; ///< The user ID of the super user + u16 const super_user_group_id{}; ///< The group ID of the super user group + u32 const first_inode_id{}; ///< The id of the first inode usable for standard files + u16 const inode_size{}; ///< The size of an inode in bytes + u16 const superblock_group_id{}; ///< The ID of the block group hosting this superblock + u32 const compatible_features{}; ///< The active compatible features + u32 const incompatible_features{}; ///< The active incompatible feature + u32 const read_only_compatible_features{}; ///< The active features compatible with read-only mode + u08_arr<16> const uuid{}; ///< The UUID of the file system + chr_arr<16> const label{}; ///< The label of the file system + chr_arr<64> const last_mount_point{}; ///< The location the file system was last mounted on + u32 const compression_algorithm{}; ///< The compression algorithm used in the file system + u08 const file_preallocated_blocks_count{}; ///< The number of blocks to preallocate for a file + u08 const directory_preallocated_blocks_count{}; ///< The number of block to preallocate for a directory + u16 const _padding{}; ///< Alignment padding + u08_arr<16> const journal_superblock_uuid{}; ///< The UUID of the superblock containing the journal + u32 const journal_inode_id{}; ///< The ID of the inode hosting the journal + u32 const journal_device_number{}; ///< The device number of the journal + u32 const last_orphan_inode_id{}; ///< The first inode in the list of inodes to delete + u32_arr<4> const hash_seed{}; ///< The seed for the directory hashing algorithm + u08 const hash_version{}; ///< The version of the directory hashing algorithm + u08_arr<3> const _reserved0{}; ///< Alignment padding + u32 const default_mount_options{}; ///< The default mount options for the file system + u32 const first_meta_block_group_id{}; ///< The ID of the first meta block group + u08_arr<760> const _reserved1{}; ///< Padding }; static_assert(sizeof(extfs_superblock) == 1024, "An ext* super block must have an exact size of 1024 byte!"); diff --git a/include/fs/detail/types.hpp b/include/fs/detail/types.hpp new file mode 100644 index 0000000..df84512 --- /dev/null +++ b/include/fs/detail/types.hpp @@ -0,0 +1,42 @@ +#ifndef EXTFS_TYPES_HPP +#define EXTFS_TYPES_HPP + +#include <array> +#include <cstdint> + +namespace fs::detail + { + + using u32 = std::uint32_t; ///< An unsigned 32-bit integer + using s32 = std::int32_t; ///< A signed 32-bit integer + using u16 = std::uint16_t; ///< An unsigned 16-bit integer + using s16 = std::uint16_t; ///< A signed 16-bit integer + using u08 = std::uint8_t; ///< An unsigned 8-bit integer + + /** + * An array of characters + * + * @tparam Size The size of the array + */ + template<std::size_t Size> + using chr_arr = std::array<char, Size>; + + /** + * An array of unsigned 8-bit integers + * + * @tparam Size The size of the array + */ + template<std::size_t Size> + using u08_arr = std::array<u08, Size>; + + /** + * An array of unsigned 32-bit integers + * + * @tparam Size The size of the array + */ + template<std::size_t Size> + using u32_arr = std::array<u32, Size>; + + } + +#endif |
