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/DeviceMgmt.cpp b/src/DeviceMgmt.cpp
index 6d6c296..f36b68a 100644
--- a/src/DeviceMgmt.cpp
+++ b/src/DeviceMgmt.cpp
@@ -15,8 +15,6 @@
#include <system_error>
#include <variant>
-namespace fs = std::filesystem;
-
std::optional<I2CDeviceParams> getI2CDeviceParams(
const I2CDeviceTypeMap& dtmap, const SensorBaseConfigMap& cfg)
{
@@ -47,7 +45,7 @@
return I2CDeviceParams(findDevType->second, *bus, *addr);
}
-static fs::path i2cBusPath(uint64_t bus)
+static std::filesystem::path i2cBusPath(uint64_t bus)
{
return {"/sys/bus/i2c/devices/i2c-" + std::to_string(bus)};
}
@@ -62,7 +60,7 @@
bool I2CDeviceParams::devicePresent() const
{
- fs::path path = i2cBusPath(bus) / deviceDirName(bus, address);
+ std::filesystem::path path = i2cBusPath(bus) / deviceDirName(bus, address);
if (type->createsHWMon)
{
@@ -71,7 +69,7 @@
// Ignore errors; anything but a clean 'true' is fine as 'false'
std::error_code ec;
- return fs::exists(path, ec);
+ return std::filesystem::exists(path, ec);
}
bool I2CDeviceParams::deviceStatic() const
@@ -81,12 +79,13 @@
return false;
}
- fs::path ofNode = i2cBusPath(bus) / deviceDirName(bus, address) / "of_node";
+ std::filesystem::path ofNode =
+ i2cBusPath(bus) / deviceDirName(bus, address) / "of_node";
// Ignore errors -- if of_node is present the device is a static DT node;
// otherwise we can assume we created it from userspace.
std::error_code ec;
- return fs::exists(ofNode, ec);
+ return std::filesystem::exists(ofNode, ec);
}
I2CDevice::I2CDevice(I2CDeviceParams params) : params(params)
@@ -111,7 +110,7 @@
}
// Try to create it: 'echo $devtype $addr > .../i2c-$bus/new_device'
- fs::path ctorPath = i2cBusPath(params.bus) / "new_device";
+ std::filesystem::path ctorPath = i2cBusPath(params.bus) / "new_device";
std::ofstream ctor(ctorPath);
if (!ctor.good())
{
@@ -144,7 +143,7 @@
// partially successful (i.e. when params.devicePresent() would return
// false but there's still a dummy i2c client device to remove)
- fs::path dtorPath = i2cBusPath(params.bus) / "delete_device";
+ std::filesystem::path dtorPath = i2cBusPath(params.bus) / "delete_device";
std::ofstream dtor(dtorPath);
if (!dtor.good())
{