Add namespaces to erase methods
Some erase objects did not have the required namespace. This change adds
the estoraged and estoraged_testing namespace where it is needed.
Testing: Not tested
Change-Id: I63757ea4d3672659f21108e5e65fd09aa1c03406
Signed-off-by: John Edward Broadbent <jebr@google.com>
diff --git a/include/erase.hpp b/include/erase.hpp
index 6d5644c..8224003 100644
--- a/include/erase.hpp
+++ b/include/erase.hpp
@@ -1,6 +1,8 @@
#pragma once
#include <string>
+namespace estoraged
+{
/** @class Erase
* @brief Erase object provides a base class for the specific erase types
*/
@@ -23,3 +25,5 @@
/* The linux path for the block device */
std::string devPath;
};
+
+} // namespace estoraged
diff --git a/include/pattern.hpp b/include/pattern.hpp
index b64eff7..69301e7 100644
--- a/include/pattern.hpp
+++ b/include/pattern.hpp
@@ -8,6 +8,8 @@
#include <span>
#include <string>
+namespace estoraged
+{
using stdplus::fd::ManagedFd;
class Pattern : public Erase
@@ -34,3 +36,5 @@
*/
void verifyPattern(uint64_t driveSize);
};
+
+} // namespace estoraged
diff --git a/include/verifyDriveGeometry.hpp b/include/verifyDriveGeometry.hpp
index 3b16641..457297b 100644
--- a/include/verifyDriveGeometry.hpp
+++ b/include/verifyDriveGeometry.hpp
@@ -4,6 +4,9 @@
#include <string_view>
+namespace estoraged
+{
+
class VerifyDriveGeometry : public Erase
{
public:
@@ -21,3 +24,5 @@
*/
void geometryOkay(uint64_t bytes);
};
+
+} // namespace estoraged
diff --git a/src/erase/erase.cpp b/src/erase/erase.cpp
index 5de96d6..6cd45f2 100644
--- a/src/erase/erase.cpp
+++ b/src/erase/erase.cpp
@@ -8,6 +8,9 @@
#include <stdplus/handle/managed.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+namespace estoraged
+{
+
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
using stdplus::fd::ManagedFd;
@@ -31,3 +34,5 @@
}
return bytes;
}
+
+} // namespace estoraged
diff --git a/src/erase/pattern.cpp b/src/erase/pattern.cpp
index 6fb08a7..0e510a0 100644
--- a/src/erase/pattern.cpp
+++ b/src/erase/pattern.cpp
@@ -15,6 +15,9 @@
#include <span>
#include <string>
+namespace estoraged
+{
+
constexpr uint32_t seed = 0x6a656272;
constexpr size_t blockSize = 4096;
constexpr size_t blockSizeUsing32 = blockSize / sizeof(uint32_t);
@@ -105,3 +108,5 @@
currentIndex = currentIndex + readSize;
}
}
+
+} // namespace estoraged
diff --git a/src/erase/verifyDriveGeometry.cpp b/src/erase/verifyDriveGeometry.cpp
index ea6c76f..2d223a7 100644
--- a/src/erase/verifyDriveGeometry.cpp
+++ b/src/erase/verifyDriveGeometry.cpp
@@ -7,6 +7,8 @@
#include <string>
+namespace estoraged
+{
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
void VerifyDriveGeometry::geometryOkay(uint64_t bytes)
@@ -36,3 +38,5 @@
std::string("OpenBMC.0.1.DriveEraseSuccess"));
}
}
+
+} // namespace estoraged
diff --git a/src/test/erase/pattern_test.cpp b/src/test/erase/pattern_test.cpp
index 358f873..98eb374 100644
--- a/src/test/erase/pattern_test.cpp
+++ b/src/test/erase/pattern_test.cpp
@@ -15,6 +15,10 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+namespace estoraged_test
+{
+
+using estoraged::Pattern;
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
TEST(pattern, patternPass)
@@ -65,3 +69,5 @@
EXPECT_NO_THROW(pass.writePattern(size - sizeof(dummyValue)));
EXPECT_THROW(pass.verifyPattern(size), InternalFailure);
}
+
+} // namespace estoraged_test
diff --git a/src/test/erase/verifyGeometry_test.cpp b/src/test/erase/verifyGeometry_test.cpp
index de4d3fa..8b362f3 100644
--- a/src/test/erase/verifyGeometry_test.cpp
+++ b/src/test/erase/verifyGeometry_test.cpp
@@ -7,6 +7,9 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+namespace estoraged_test
+{
+using estoraged::VerifyDriveGeometry;
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
TEST(VerifyGeometry, TooBigFail)
@@ -28,3 +31,5 @@
VerifyDriveGeometry passVerify("");
EXPECT_NO_THROW(passVerify.geometryOkay(ERASE_MIN_GEOMETRY + 1));
}
+
+} // namespace estoraged_test