Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "dump_entry.hpp" |
| 4 | |
| 5 | #include <sdbusplus/bus.hpp> |
| 6 | #include <sdbusplus/server/object.hpp> |
| 7 | #include <xyz/openbmc_project/Object/Delete/server.hpp> |
| 8 | #include <xyz/openbmc_project/Time/EpochTime/server.hpp> |
| 9 | |
| 10 | #include <filesystem> |
| 11 | |
| 12 | namespace phosphor |
| 13 | { |
| 14 | namespace dump |
| 15 | { |
| 16 | namespace faultlog |
| 17 | { |
| 18 | template <typename T> |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 19 | using ServerObject = typename sdbusplus::server::object_t<T>; |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 20 | |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 21 | using EntryIfaces = sdbusplus::server::object_t<>; |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 22 | |
| 23 | class Manager; |
| 24 | |
| 25 | /** @class Entry |
| 26 | * @brief OpenBMC Fault Log Dump Entry implementation. |
| 27 | */ |
| 28 | class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry |
| 29 | { |
| 30 | public: |
| 31 | Entry() = delete; |
| 32 | Entry(const Entry&) = delete; |
| 33 | Entry& operator=(const Entry&) = delete; |
| 34 | Entry(Entry&&) = delete; |
| 35 | Entry& operator=(Entry&&) = delete; |
| 36 | ~Entry() = default; |
| 37 | |
| 38 | /** @brief Constructor for the Dump Entry Object |
| 39 | * @param[in] bus - Bus to attach to. |
| 40 | * @param[in] objPath - Object path to attach to |
| 41 | * @param[in] dumpId - Dump id. |
| 42 | * @param[in] timeStamp - Dump creation timestamp |
| 43 | * in microseconds since the epoch. |
| 44 | * @param[in] fileSize - Dump file size in bytes. |
| 45 | * @param[in] file - Full path of dump file. |
| 46 | * @param[in] status - status of the dump. |
| 47 | * @param[in] parent - The dump entry's parent. |
| 48 | */ |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 49 | Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId, |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 50 | uint64_t timeStamp, uint64_t fileSize, |
| 51 | const std::filesystem::path& file, |
| 52 | phosphor::dump::OperationStatus status, |
| 53 | phosphor::dump::Manager& parent) : |
| 54 | EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit), |
| 55 | phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize, |
| 56 | status, parent), |
| 57 | file(file) |
| 58 | { |
| 59 | // Emit deferred signal. |
| 60 | this->phosphor::dump::faultlog::EntryIfaces::emit_object_added(); |
| 61 | } |
| 62 | |
| 63 | /** @brief Delete this d-bus object. |
| 64 | */ |
| 65 | void delete_() override; |
| 66 | |
| 67 | private: |
| 68 | /** @Dump file path */ |
| 69 | std::filesystem::path file; |
| 70 | }; |
| 71 | |
| 72 | } // namespace faultlog |
| 73 | } // namespace dump |
| 74 | } // namespace phosphor |