diff options
Diffstat (limited to 'src/fs/detail/superblock.cpp')
| -rw-r--r-- | src/fs/detail/superblock.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/fs/detail/superblock.cpp b/src/fs/detail/superblock.cpp new file mode 100644 index 0000000..f238098 --- /dev/null +++ b/src/fs/detail/superblock.cpp @@ -0,0 +1,65 @@ +#include "fs/detail/superblock.hpp" + +#include <algorithm> + +namespace fs::detail + { + + bool superblock::has(superblock::compatible_feature const feature) const + { + return compatible_features_bitmap & static_cast<decltype(compatible_features_bitmap)>(feature); + } + + bool superblock::has_all(std::initializer_list<superblock::compatible_feature> const features) const + { + return std::all_of(features.begin(), features.end(), [&](auto const feature){ + return compatible_features_bitmap & static_cast<decltype(compatible_features_bitmap)>(feature); + }); + } + + bool superblock::has_any(std::initializer_list<superblock::compatible_feature> const features) const + { + return std::any_of(features.begin(), features.end(), [&](auto const feature){ + return compatible_features_bitmap & static_cast<decltype(compatible_features_bitmap)>(feature); + }); + } + + bool superblock::has(superblock::incompatible_feature const feature) const + { + return incompatible_features_bitmap & static_cast<decltype(incompatible_features_bitmap)>(feature); + } + + bool superblock::has_all(std::initializer_list<superblock::incompatible_feature> const features) const + { + return std::all_of(features.begin(), features.end(), [&](auto const feature){ + return incompatible_features_bitmap & static_cast<decltype(incompatible_features_bitmap)>(feature); + }); + } + + bool superblock::has_any(std::initializer_list<superblock::incompatible_feature> const features) const + { + return std::any_of(features.begin(), features.end(), [&](auto const feature){ + return incompatible_features_bitmap & static_cast<decltype(incompatible_features_bitmap)>(feature); + }); + } + + bool superblock::has(superblock::read_only_compatible_feature const feature) const + { + return read_only_compatible_features_bitmap & static_cast<decltype(read_only_compatible_features_bitmap)>(feature); + } + + bool superblock::has_all(std::initializer_list<superblock::read_only_compatible_feature> const features) const + { + return std::all_of(features.begin(), features.end(), [&](auto const feature){ + return read_only_compatible_features_bitmap & static_cast<decltype(read_only_compatible_features_bitmap)>(feature); + }); + } + + bool superblock::has_any(std::initializer_list<superblock::read_only_compatible_feature> const features) const + { + return std::any_of(features.begin(), features.end(), [&](auto const feature){ + return read_only_compatible_features_bitmap & static_cast<decltype(read_only_compatible_features_bitmap)>(feature); + }); + } + + } |
