Deprecate std::filesystem namespace include
Clang-tidy is complaining about our using fs = ... directives. These
were originally added to handle boost::filesystem vs
std::experimental::filesystem vs std::filesystem between the various
compilers. Now that we're all on std::filesystem, this redefinition can
be removed.
```
ChassisIntrusionSensor.hpp:11:11: error: namespace alias decl 'fs' is unused [misc-unused-alias-decls,-warnings-as-errors]
11 | namespace fs = std::filesystem;
```
Tested: code compiles
Change-Id: If4b968ff9cceb4038f526321d3c7c11563ffbce9
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/src/psu/PSUSensorMain.cpp b/src/psu/PSUSensorMain.cpp
index e99a700..ea853ad 100644
--- a/src/psu/PSUSensorMain.cpp
+++ b/src/psu/PSUSensorMain.cpp
@@ -154,8 +154,6 @@
std::string nameRegEx;
};
-namespace fs = std::filesystem;
-
static boost::container::flat_map<std::string, std::shared_ptr<PSUSensor>>
sensors;
static boost::container::flat_map<std::string, std::unique_ptr<PSUCombineEvent>>
@@ -203,8 +201,9 @@
GroupEventPathList& groupEventPathList)
{
EventPathList pathList;
- std::vector<fs::path> eventPaths;
- if (!findFiles(fs::path(directory), R"(fan\d+_(alarm|fault))", eventPaths))
+ std::vector<std::filesystem::path> eventPaths;
+ if (!findFiles(std::filesystem::path(directory), R"(fan\d+_(alarm|fault))",
+ eventPaths))
{
return;
}
@@ -258,7 +257,7 @@
}
static void checkPWMSensor(
- const fs::path& sensorPath, std::string& labelHead,
+ const std::filesystem::path& sensorPath, std::string& labelHead,
const std::string& interfacePath,
std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
sdbusplus::asio::object_server& objectServer, const std::string& psuName)
@@ -310,9 +309,10 @@
auto devices = instantiateDevices(sensorConfigs, sensors, sensorTypes);
- std::vector<fs::path> pmbusPaths;
- findFiles(fs::path("/sys/bus/iio/devices"), "name", pmbusPaths);
- findFiles(fs::path("/sys/class/hwmon"), "name", pmbusPaths);
+ std::vector<std::filesystem::path> pmbusPaths;
+ findFiles(std::filesystem::path("/sys/bus/iio/devices"), "name",
+ pmbusPaths);
+ findFiles(std::filesystem::path("/sys/class/hwmon"), "name", pmbusPaths);
if (pmbusPaths.empty())
{
std::cerr << "No PSU sensors in system\n";
@@ -358,7 +358,8 @@
std::string deviceName;
if (directory.parent_path() == "/sys/class/hwmon")
{
- std::string devicePath = fs::canonical(directory / "device");
+ std::string devicePath =
+ std::filesystem::canonical(directory / "device");
std::smatch match;
// Find /i2c-<bus>/<bus>-<address> match in device path
std::regex_search(devicePath, match, i2cDevRegex);
@@ -373,7 +374,8 @@
}
else
{
- deviceName = fs::canonical(directory).parent_path().stem();
+ deviceName =
+ std::filesystem::canonical(directory).parent_path().stem();
devType = DevTypes::IIO;
}
@@ -530,7 +532,7 @@
findPSUName = baseConfig->find("Name" + std::to_string(i++));
} while (findPSUName != baseConfig->end());
- std::vector<fs::path> sensorPaths;
+ std::vector<std::filesystem::path> sensorPaths;
if (!findFiles(directory, devParamMap[devType].matchRegEx, sensorPaths,
0))
{