Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 1 | #include "config.h" |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 2 | |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 3 | #include "elog_meta.hpp" |
| 4 | |
Patrick Williams | a06b4c6 | 2024-11-21 11:43:39 -0500 | [diff] [blame] | 5 | #include "util.hpp" |
| 6 | |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 7 | namespace phosphor |
| 8 | { |
| 9 | namespace logging |
| 10 | { |
| 11 | namespace metadata |
| 12 | { |
| 13 | namespace associations |
| 14 | { |
| 15 | |
| 16 | #if defined PROCESS_META |
| 17 | |
| 18 | template <> |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 19 | void build<xyz::openbmc_project::common::callout::Device::CALLOUT_DEVICE_PATH>( |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 20 | const std::string& match, const std::vector<std::string>& data, |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 21 | AssociationList& list) |
| 22 | { |
Patrick Williams | a06b4c6 | 2024-11-21 11:43:39 -0500 | [diff] [blame] | 23 | auto metadata = util::additional_data::parse(data); |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 24 | auto iter = metadata.find(match); |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 25 | if (metadata.end() != iter) |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 26 | { |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 27 | auto comp = [](const auto& first, const auto& second) { |
Patrick Venture | 30047bf | 2018-11-01 18:52:15 -0700 | [diff] [blame] | 28 | return (std::strcmp(std::get<0>(first), second) < 0); |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 29 | }; |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 30 | auto callout = std::lower_bound(callouts.begin(), callouts.end(), |
| 31 | (iter->second).c_str(), comp); |
| 32 | if ((callouts.end() != callout) && |
Patrick Venture | 30047bf | 2018-11-01 18:52:15 -0700 | [diff] [blame] | 33 | !std::strcmp((iter->second).c_str(), std::get<0>(*callout))) |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 34 | { |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 35 | list.emplace_back(std::make_tuple( |
| 36 | CALLOUT_FWD_ASSOCIATION, CALLOUT_REV_ASSOCIATION, |
| 37 | std::string(INVENTORY_ROOT) + std::get<1>(*callout))); |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
Tom Joseph | 213aaf6 | 2017-07-25 00:02:09 +0530 | [diff] [blame] | 42 | template <> |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 43 | void build< |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 44 | xyz::openbmc_project::common::callout::Inventory::CALLOUT_INVENTORY_PATH>( |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 45 | const std::string& match, const std::vector<std::string>& data, |
Tom Joseph | 213aaf6 | 2017-07-25 00:02:09 +0530 | [diff] [blame] | 46 | AssociationList& list) |
| 47 | { |
Patrick Williams | a06b4c6 | 2024-11-21 11:43:39 -0500 | [diff] [blame] | 48 | auto metadata = util::additional_data::parse(data); |
Tom Joseph | 213aaf6 | 2017-07-25 00:02:09 +0530 | [diff] [blame] | 49 | auto iter = metadata.find(match); |
| 50 | if (metadata.end() != iter) |
| 51 | { |
Patrick Williams | 075c792 | 2024-08-16 15:19:49 -0400 | [diff] [blame] | 52 | list.emplace_back( |
| 53 | std::make_tuple(CALLOUT_FWD_ASSOCIATION, CALLOUT_REV_ASSOCIATION, |
| 54 | std::string(iter->second.c_str()))); |
Tom Joseph | 213aaf6 | 2017-07-25 00:02:09 +0530 | [diff] [blame] | 55 | } |
| 56 | } |
| 57 | |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 58 | #endif |
| 59 | |
| 60 | } // namespace associations |
| 61 | } // namespace metadata |
| 62 | } // namespace logging |
| 63 | } // namespace phosphor |