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. |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 47 | * @param[in] originatorId - Id of the originator of the dump |
| 48 | * @param[in] originatorType - Originator type |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 49 | * @param[in] parent - The dump entry's parent. |
| 50 | */ |
Patrick Williams | 9b18bf2 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 51 | Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId, |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 52 | uint64_t timeStamp, uint64_t fileSize, |
| 53 | const std::filesystem::path& file, |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 54 | phosphor::dump::OperationStatus status, std::string originatorId, |
| 55 | originatorTypes originatorType, phosphor::dump::Manager& parent) : |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 56 | EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit), |
| 57 | phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize, |
Asmitha Karunanithi | 74a1f39 | 2021-10-27 03:23:59 -0500 | [diff] [blame] | 58 | status, originatorId, originatorType, parent), |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 59 | file(file) |
| 60 | { |
| 61 | // Emit deferred signal. |
| 62 | this->phosphor::dump::faultlog::EntryIfaces::emit_object_added(); |
| 63 | } |
| 64 | |
| 65 | /** @brief Delete this d-bus object. |
| 66 | */ |
| 67 | void delete_() override; |
| 68 | |
| 69 | private: |
| 70 | /** @Dump file path */ |
| 71 | std::filesystem::path file; |
| 72 | }; |
| 73 | |
| 74 | } // namespace faultlog |
| 75 | } // namespace dump |
| 76 | } // namespace phosphor |