move getEnv methods into env namespace

Move the getEnv(...) methods into the env namespace,
for consistency.

Change-Id: I4055d9456c17f8b20071cdee1b8e531c10fb0c7e
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/env.cpp b/env.cpp
index ab4b35c..09dd985 100644
--- a/env.cpp
+++ b/env.cpp
@@ -20,6 +20,8 @@
 #include "env.hpp"
 #include "hwmon.hpp"
 
+namespace env {
+
 std::string getEnv(
     const char* prefix, const SensorSet::key_type& sensor)
 {
@@ -76,4 +78,6 @@
     return content;
 }
 
+}  // namespace env
+
 // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
diff --git a/env.hpp b/env.hpp
index e14dd17..50a9fdb 100644
--- a/env.hpp
+++ b/env.hpp
@@ -4,6 +4,8 @@
 
 #include "sensorset.hpp"
 
+namespace env {
+
 /** @brief Reads an environment variable
  *
  *  Reads <prefix>_<sensor.first><sensor.second>
@@ -40,3 +42,5 @@
 std::string getIndirectID(
     std::string path,
     const SensorSet::key_type& sensor);
+
+}  // namespace env
diff --git a/fan_speed.cpp b/fan_speed.cpp
index 2652f8d..15ce946 100644
--- a/fan_speed.cpp
+++ b/fan_speed.cpp
@@ -58,7 +58,7 @@
 
 void FanSpeed::enable()
 {
-    auto enable = getEnv("ENABLE", type, id);
+    auto enable = env::getEnv("ENABLE", type, id);
     if (!enable.empty())
     {
         auto val = std::stoul(enable);
diff --git a/mainloop.cpp b/mainloop.cpp
index 62467fd..99c8020 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -219,7 +219,7 @@
     auto& obj = std::get<Object>(info);
     auto& objPath = std::get<std::string>(info);
 
-    auto senRmRCs = getEnv("REMOVERCS", sensor);
+    auto senRmRCs = env::getEnv("REMOVERCS", sensor);
     if (!senRmRCs.empty())
     {
         // Add sensor removal return codes defined per sensor
@@ -236,13 +236,13 @@
             std::get<std::chrono::milliseconds>(retryIO),
             isOCC);
 
-    auto gain = getEnv("GAIN", sensor);
+    auto gain = env::getEnv("GAIN", sensor);
     if (!gain.empty())
     {
         sensorAdjusts[sensor].gain = std::stod(gain);
     }
 
-    auto offset = getEnv("OFFSET", sensor);
+    auto offset = env::getEnv("OFFSET", sensor);
     if (!offset.empty())
     {
         sensorAdjusts[sensor].offset = std::stoi(offset);
@@ -260,12 +260,12 @@
         iface->scale(getScale(attrs));
     }
 
-    auto maxValue = getEnv("MAXVALUE", sensor);
+    auto maxValue = env::getEnv("MAXVALUE", sensor);
     if(!maxValue.empty())
     {
         iface->maxValue(std::stoll(maxValue));
     }
-    auto minValue = getEnv("MINVALUE", sensor);
+    auto minValue = env::getEnv("MINVALUE", sensor);
     if(!minValue.empty())
     {
         iface->minValue(std::stoll(minValue));
@@ -304,10 +304,10 @@
      * doesn't exist, then the name of DBUS object is the value of the env
      * variable LABEL_<item><X>.
      */
-    auto mode = getEnv("MODE", sensor.first);
+    auto mode = env::getEnv("MODE", sensor.first);
     if (!mode.compare(hwmon::entry::label))
     {
-        id = getIndirectID(
+        id = env::getIndirectID(
                 _hwmonRoot + '/' + _instance + '/', sensor.first);
 
         if (id.empty())
@@ -321,7 +321,7 @@
     id = (id.empty()) ? sensor.first.second : id;
 
     // Ignore inputs without a label.
-    label = getEnv("LABEL", sensor.first.first, id);
+    label = env::getEnv("LABEL", sensor.first.first, id);
     if (label.empty())
     {
         return;
diff --git a/targets.hpp b/targets.hpp
index 3c6dc0d..fe256a3 100644
--- a/targets.hpp
+++ b/targets.hpp
@@ -4,6 +4,7 @@
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
 #include <xyz/openbmc_project/Sensor/Device/error.hpp>
+#include "env.hpp"
 #include "fan_speed.hpp"
 #include "fan_pwm.hpp"
 
@@ -87,7 +88,7 @@
     {
         targetName = pwm;
         // If PWM_TARGET is set, use the specified pwm id
-        auto id = getEnv("PWM_TARGET", sensor);
+        auto id = env::getEnv("PWM_TARGET", sensor);
         if (!id.empty())
         {
             targetId = id;
diff --git a/thresholds.hpp b/thresholds.hpp
index 96d4b75..684e712 100644
--- a/thresholds.hpp
+++ b/thresholds.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "env.hpp"
+
 /** @class Thresholds
  *  @brief Threshold type traits.
  *
@@ -90,8 +92,8 @@
     auto& obj = std::get<Object>(info);
     std::shared_ptr<T> iface;
 
-    auto tLo = getEnv(Thresholds<T>::envLo, sensorType, sensorID);
-    auto tHi = getEnv(Thresholds<T>::envHi, sensorType, sensorID);
+    auto tLo = env::getEnv(Thresholds<T>::envLo, sensorType, sensorID);
+    auto tHi = env::getEnv(Thresholds<T>::envHi, sensorType, sensorID);
     if (!tLo.empty() && !tHi.empty())
     {
         iface = std::make_shared<T>(bus, objPath.c_str(), deferSignals);