From 9fcc4755684b79d0fe95e38a6fbaf13772da7e1a Mon Sep 17 00:00:00 2001 From: Henri Casanova Date: Fri, 31 May 2024 10:24:08 -0700 Subject: [PATCH] Added a FileSystem::get_partitions() method --- include/fsmod/FileSystem.hpp | 5 ++++- src/FileSystem.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/fsmod/FileSystem.hpp b/include/fsmod/FileSystem.hpp index b9c8314..46a9a8f 100644 --- a/include/fsmod/FileSystem.hpp +++ b/include/fsmod/FileSystem.hpp @@ -55,8 +55,11 @@ namespace simgrid::fsmod { [[nodiscard]] std::shared_ptr partition_by_name(const std::string& name) const; [[nodiscard]] std::shared_ptr partition_by_name_or_null(const std::string& name) const; + [[nodiscard]] std::vector> get_partitions() const; - private: + + + private: [[nodiscard]] std::pair, std::string> find_path_at_mount_point(const std::string &full_path) const; std::map, std::less<>> partitions_; diff --git a/src/FileSystem.cpp b/src/FileSystem.cpp index 0d1812c..c8497bd 100644 --- a/src/FileSystem.cpp +++ b/src/FileSystem.cpp @@ -110,6 +110,16 @@ namespace simgrid::fsmod { return nullptr; } + std::vector> FileSystem::get_partitions() const { + std::vector> to_return; + to_return.reserve(this->partitions_.size()); + for (auto const &p : this->partitions_) { + to_return.push_back(p.second); + } + return to_return; + } + + /** * @brief Create a new file on the file system in zero time * @param full_path: the absolute path to the file