aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-08-26 14:45:31 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-08-26 20:37:48 +0200
commit35175463977f85d949b2168a4f062158d2a911d1 (patch)
tree948be02818781163b4fba27427e6d958916dc92e
parenta08dbf62d8dedd6501743598f5a3c4bfc464208d (diff)
downloadkernel-35175463977f85d949b2168a4f062158d2a911d1.tar.xz
kernel-35175463977f85d949b2168a4f062158d2a911d1.zip
kernel/fs: ext2: move superblock flags
-rw-r--r--kernel/kernel/filesystem/ext2/filesystem.cpp4
-rw-r--r--kernel/kernel/filesystem/ext2/filesystem.hpp22
-rw-r--r--kernel/kernel/filesystem/ext2/superblock.hpp42
3 files changed, 41 insertions, 27 deletions
diff --git a/kernel/kernel/filesystem/ext2/filesystem.cpp b/kernel/kernel/filesystem/ext2/filesystem.cpp
index bf977c46..4f5ff686 100644
--- a/kernel/kernel/filesystem/ext2/filesystem.cpp
+++ b/kernel/kernel/filesystem/ext2/filesystem.cpp
@@ -133,8 +133,8 @@ namespace kernel::filesystem::ext2
return kstd::failure(ext2_errc::invalid_magic_number);
}
- if (superblock.feature_incompat & std::to_underlying(~supported_incompatible_features) ||
- superblock.feature_ro_compat & std::to_underlying(~supported_ro_compatible_features))
+ if (std::to_underlying(superblock.feature_incompat & ~supported_incompatible_features) ||
+ std::to_underlying(superblock.feature_ro_compat & ~supported_ro_compatible_features))
{
return kstd::failure(ext2_errc::unsupported_features_present);
}
diff --git a/kernel/kernel/filesystem/ext2/filesystem.hpp b/kernel/kernel/filesystem/ext2/filesystem.hpp
index 6d5720a2..66db7589 100644
--- a/kernel/kernel/filesystem/ext2/filesystem.hpp
+++ b/kernel/kernel/filesystem/ext2/filesystem.hpp
@@ -57,28 +57,6 @@ namespace kernel::filesystem::ext2
} // namespace constants
- //! Ext2 incompatibility features
- //!
- //! These enumerators describe the flags that might not be supported by an ext2 driver.
- enum struct incompatible_features
- {
- compression = 0x0001,
- file_types_in_directory_entries = 0x0002,
- recovery = 0x0004,
- external_journal_device = 0x0008,
- meta_block_group_layout = 0x0010,
- };
-
- //! Ext2 read-only compatible features
- //!
- //! There enumerators describe the flags that might prevent read-write access for a driver.
- enum struct read_only_compatible_features
- {
- sparse_superblock_copies = 0x0001,
- large_file_support = 0x0002,
- binary_tree_directories = 0x0003,
- };
-
//! The Second Extended Filesystem (ext2)
struct filesystem final : kernel::filesystem::filesystem
{
diff --git a/kernel/kernel/filesystem/ext2/superblock.hpp b/kernel/kernel/filesystem/ext2/superblock.hpp
index 0fe5d4e5..e5cd845b 100644
--- a/kernel/kernel/filesystem/ext2/superblock.hpp
+++ b/kernel/kernel/filesystem/ext2/superblock.hpp
@@ -6,6 +6,42 @@
namespace kernel::filesystem::ext2
{
+
+ //! Ext2 compatible features.
+ //!
+ //! These enumerators describe the flags that may be ignored by the an ext2 driver.
+ enum struct compatible_features : std::uint32_t
+ {
+ directory_preallocation = 1 << 0,
+ magic_inodes = 1 << 1,
+ ext3_journal = 1 << 2,
+ extended_attributes = 1 << 3,
+ non_standard_inode_size = 1 << 4,
+ hashed_directory_indexing = 1 << 5,
+ };
+
+ //! Ext2 incompatibility features
+ //!
+ //! These enumerators describe the flags that might not be supported by an ext2 driver.
+ enum struct incompatible_features : std::uint32_t
+ {
+ compression = 1 << 0,
+ file_types_in_directory_entries = 1 << 1,
+ journal_recovery_required = 1 << 2,
+ external_journal_device = 1 << 3,
+ meta_block_group_layout = 1 << 4,
+ };
+
+ //! Ext2 read-only compatible features
+ //!
+ //! There enumerators describe the flags that might prevent read-write access for a driver.
+ enum struct read_only_compatible_features : std::uint32_t
+ {
+ sparse_superblock_copies = 1 << 0,
+ large_file_support = 1 << 1,
+ binary_tree_directories = 1 << 2,
+ };
+
//! The superblock in the ext2 filesystem.
struct [[gnu::packed]] superblock
{
@@ -39,9 +75,9 @@ namespace kernel::filesystem::ext2
uint32_t first_ino;
uint16_t inode_size;
uint16_t block_group_nr;
- uint32_t feature_compat;
- uint32_t feature_incompat;
- uint32_t feature_ro_compat;
+ compatible_features feature_compat;
+ incompatible_features feature_incompat;
+ read_only_compatible_features feature_ro_compat;
std::array<uint8_t, 16> uuid;
std::array<uint8_t, 16> volume_name;
std::array<uint8_t, 64> last_mounted;