utils.cpp (9a286db223cecd88ecdcf29e6a1e713fdd1bf115) utils.cpp (78c066f6078704fd202c8a4b02fcf73091481ef1)
1#include "config.h"
2
3#include "utils.hpp"
4
1#include "config.h"
2
3#include "utils.hpp"
4
5#include <fmt/format.h>
6#include <fmt/printf.h>
7#include <gpiod.h>
8
9#include <phosphor-logging/lg2.hpp>
10#include <xyz/openbmc_project/Dump/Create/client.hpp>
11#include <xyz/openbmc_project/Logging/Create/client.hpp>
12#include <xyz/openbmc_project/ObjectMapper/client.hpp>
13#include <xyz/openbmc_project/State/BMC/client.hpp>
14
15#include <chrono>
16#include <filesystem>
5#include <gpiod.h>
6
7#include <phosphor-logging/lg2.hpp>
8#include <xyz/openbmc_project/Dump/Create/client.hpp>
9#include <xyz/openbmc_project/Logging/Create/client.hpp>
10#include <xyz/openbmc_project/ObjectMapper/client.hpp>
11#include <xyz/openbmc_project/State/BMC/client.hpp>
12
13#include <chrono>
14#include <filesystem>
15#include <format>
17
18namespace phosphor
19{
20namespace state
21{
22namespace manager
23{
24namespace utils

--- 200 unchanged lines hidden (view full) ---

225 error("Failed to create BMC dump, exception:{ERROR}", "ERROR", e);
226 // just continue, this is error path anyway so we're just collecting
227 // what we can
228 }
229}
230
231bool checkACLoss(size_t& chassisId)
232{
16
17namespace phosphor
18{
19namespace state
20{
21namespace manager
22{
23namespace utils

--- 200 unchanged lines hidden (view full) ---

224 error("Failed to create BMC dump, exception:{ERROR}", "ERROR", e);
225 // just continue, this is error path anyway so we're just collecting
226 // what we can
227 }
228}
229
230bool checkACLoss(size_t& chassisId)
231{
233 std::string chassisLostPowerFileFmt = fmt::sprintf(CHASSIS_LOST_POWER_FILE,
234 chassisId);
232 std::string chassisLostPowerFileFmt = std::format(CHASSIS_LOST_POWER_FILE,
233 chassisId);
235
236 std::filesystem::path chassisPowerLossFile{chassisLostPowerFileFmt};
237 if (std::filesystem::exists(chassisPowerLossFile))
238 {
239 return true;
240 }
241
242 return false;

--- 38 unchanged lines hidden ---
234
235 std::filesystem::path chassisPowerLossFile{chassisLostPowerFileFmt};
236 if (std::filesystem::exists(chassisPowerLossFile))
237 {
238 return true;
239 }
240
241 return false;

--- 38 unchanged lines hidden ---