From c7c3e40249fcba41b4c6b15676fc1054e6ce1049 Mon Sep 17 00:00:00 2001 From: Matt Spinler Date: Wed, 22 Jan 2020 15:07:25 -0600 Subject: PEL: Move util namespace to bottom of pel.cpp It makes more sense for the util code to be at the bottom of the file rather than in the middle. Signed-off-by: Matt Spinler Change-Id: I46fe120849377bdf9397aa72addda1e9dfa4e56c --- extensions/openpower-pels/pel.cpp | 74 +++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'extensions/openpower-pels') diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp index 6d3f010..625d177 100644 --- a/extensions/openpower-pels/pel.cpp +++ b/extensions/openpower-pels/pel.cpp @@ -204,43 +204,6 @@ void PEL::checkRulesAndFix() _uh->setEventType(eventType); } -namespace util -{ - -std::unique_ptr makeADUserDataSection(const AdditionalData& ad) -{ - assert(!ad.empty()); - nlohmann::json json; - - // Remove the 'ESEL' entry, as it contains a full PEL in the value. - if (ad.getValue("ESEL")) - { - auto newAD = ad; - newAD.remove("ESEL"); - json = newAD.toJSON(); - } - else - { - json = ad.toJSON(); - } - - auto jsonString = json.dump(); - std::vector jsonData(jsonString.begin(), jsonString.end()); - - // Pad to a 4 byte boundary - while ((jsonData.size() % 4) != 0) - { - jsonData.push_back(0); - } - - return std::make_unique( - static_cast(ComponentID::phosphorLogging), - static_cast(UserDataFormat::json), - static_cast(UserDataFormatVersion::json), jsonData); -} - -} // namespace util - void PEL::printSectionInJSON(const Section& section, std::string& buf, std::map& pluralSections) const { @@ -333,5 +296,42 @@ void PEL::toJSON() const std::cout << buf << std::endl; } +namespace util +{ + +std::unique_ptr makeADUserDataSection(const AdditionalData& ad) +{ + assert(!ad.empty()); + nlohmann::json json; + + // Remove the 'ESEL' entry, as it contains a full PEL in the value. + if (ad.getValue("ESEL")) + { + auto newAD = ad; + newAD.remove("ESEL"); + json = newAD.toJSON(); + } + else + { + json = ad.toJSON(); + } + + auto jsonString = json.dump(); + std::vector jsonData(jsonString.begin(), jsonString.end()); + + // Pad to a 4 byte boundary + while ((jsonData.size() % 4) != 0) + { + jsonData.push_back(0); + } + + return std::make_unique( + static_cast(ComponentID::phosphorLogging), + static_cast(UserDataFormat::json), + static_cast(UserDataFormatVersion::json), jsonData); +} + +} // namespace util + } // namespace pels } // namespace openpower -- cgit v1.2.1