summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/CMakeLists.txt3
-rw-r--r--src/fs/detail/superblock.cpp65
2 files changed, 67 insertions, 1 deletions
diff --git a/src/fs/CMakeLists.txt b/src/fs/CMakeLists.txt
index 3ca33b8..4e2d1d6 100644
--- a/src/fs/CMakeLists.txt
+++ b/src/fs/CMakeLists.txt
@@ -6,5 +6,6 @@ endif()
add_library(extfs
${LIBRARY_TYPE}
- extfs.cpp
+ "extfs.cpp"
+ "detail/superblock.cpp"
)
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);
+ });
+ }
+
+ }