diff options
author | Nagaraju Goruganti <ngorugan@in.ibm.com> | 2017-09-12 06:14:46 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-09-29 01:42:03 +0000 |
commit | 3c899a4d2e3abe269c2b6ccc5260bd33f95e8e92 (patch) | |
tree | 3d42059a9ffc490fc11821f47e99d5a791e8abf3 | |
parent | e4693a7f44b7f95d94aecf2aa3c481d7ed1cd3a2 (diff) | |
download | phosphor-debug-collector-3c899a4d2e3abe269c2b6ccc5260bd33f95e8e92.tar.gz phosphor-debug-collector-3c899a4d2e3abe269c2b6ccc5260bd33f95e8e92.zip |
Add implementation for delete all BMC Dumps in one shot
Resolves openbmc/openbmc#2255
Change-Id: I8383c55f0f55ac02e509d17c47bc66d326994301
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
-rw-r--r-- | dump_manager.cpp | 11 | ||||
-rw-r--r-- | dump_manager.hpp | 15 |
2 files changed, 23 insertions, 3 deletions
diff --git a/dump_manager.cpp b/dump_manager.cpp index 6ac636d..28d3b77 100644 --- a/dump_manager.cpp +++ b/dump_manager.cpp @@ -154,6 +154,17 @@ void Manager::erase(uint32_t entryId) entries.erase(entryId); } +void Manager::deleteAll() +{ + auto iter = entries.begin(); + while (iter != entries.end()) + { + auto& entry = iter->second; + entry->delete_(); + ++iter; + } +} + void Manager::watchCallback(const UserMap& fileInfo) { for (const auto& i : fileInfo) diff --git a/dump_manager.hpp b/dump_manager.hpp index ef3cd22..f12d7ff 100644 --- a/dump_manager.hpp +++ b/dump_manager.hpp @@ -7,6 +7,7 @@ #include <xyz/openbmc_project/Dump/Create/server.hpp> #include "xyz/openbmc_project/Dump/Internal/Create/server.hpp" +#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp" #include "dump_entry.hpp" #include "dump_utils.hpp" #include "watch.hpp" @@ -28,8 +29,9 @@ using UserMap = phosphor::dump::inotify::UserMap; using Type = sdbusplus::xyz::openbmc_project::Dump::Internal::server::Create::Type; -using CreateIface = sdbusplus::server::object::object< - sdbusplus::xyz::openbmc_project::Dump::server::Create>; +using CreateIface = sdbusplus::server::object::object < + sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll, + sdbusplus::xyz::openbmc_project::Dump::server::Create >; namespace fs = std::experimental::filesystem; @@ -38,7 +40,8 @@ using Watch = phosphor::dump::inotify::Watch; /** @class Manager * @brief OpenBMC Dump manager implementation. * @details A concrete implementation for the - * xyz.openbmc_project.Dump.Create DBus API. + * xyz.openbmc_project.Dump.Create DBus API and + * xyz::openbmc_project::Collection::server::DeleteAll. */ class Manager : public CreateIface { @@ -114,6 +117,12 @@ class Manager : public CreateIface */ void erase(uint32_t entryId); + /** @brief Erase all BMC dump entries and Delete all Dump files + * from Permanent location + * + */ + void deleteAll() override; + /** @brief sd_event_add_child callback * * @param[in] s - event source |