From 235b3c76c354f9242192f56cab609ec9e53c0cc3 Mon Sep 17 00:00:00 2001 From: Patrick Venture Date: Fri, 23 Aug 2019 09:16:07 -0700 Subject: move entities into ipmi::sensor namespace The object was left in the global namespace, but the type was in the ipmi::sensor namespace. Move the object into the namespace. Signed-off-by: Patrick Venture Change-Id: If3aa72ebbae980b0b837c45c8fcbc4b47b7fb742 --- scripts/writeentity.mako.cpp | 6 +++++- sensorhandler.cpp | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/writeentity.mako.cpp b/scripts/writeentity.mako.cpp index 110eca9..04ea87c 100644 --- a/scripts/writeentity.mako.cpp +++ b/scripts/writeentity.mako.cpp @@ -5,7 +5,8 @@ #include #include -using namespace ipmi::sensor; +namespace ipmi { +namespace sensor { extern const EntityInfoMap entities = { % for key in entityDict.iterkeys(): @@ -34,3 +35,6 @@ extern const EntityInfoMap entities = { }}, % endfor }; + +} // namespace sensor +} // namespace ipmi diff --git a/sensorhandler.cpp b/sensorhandler.cpp index d2594f5..1901464 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -28,7 +28,6 @@ extern int updateSensorRecordFromSSRAESC(const void*); extern sd_bus* bus; extern const ipmi::sensor::IdInfoMap sensors; extern const FruMap frus; -extern const ipmi::sensor::EntityInfoMap entities; using namespace phosphor::logging; using InternalFailure = @@ -78,11 +77,20 @@ struct sensorreadingresp_t uint8_t indication[2]; } __attribute__((packed)); -const ipmi::sensor::EntityInfoMap& getIpmiEntityRecords() +namespace ipmi +{ +namespace sensor +{ +extern const EntityInfoMap entities; + +const EntityInfoMap& getIpmiEntityRecords() { return entities; } +} // namespace sensor +} // namespace ipmi + int get_bus_for_path(const char* path, char** busname) { return mapper_get_service(bus, path, busname); @@ -599,7 +607,7 @@ ipmi::RspTypefirst + ENTITY_RECORD_ID_START @@ -806,7 +814,7 @@ ipmi_ret_t ipmi_entity_get_sdr(ipmi_request_t request, ipmi_response_t response, get_sdr::SensorDataEntityRecord record{}; auto dataLength = 0; - const auto& entityRecords = getIpmiEntityRecords(); + const auto& entityRecords = ipmi::sensor::getIpmiEntityRecords(); auto entity = entityRecords.begin(); uint8_t entityRecordID; auto recordID = get_sdr::request::get_record_id(req); -- cgit v1.2.1