[clang-tidy] Fix clang-tidy errors from g3/gsgys config [2/2]
Fix the clang-tidy errors found here: https://paste.googleplex.com/5414723251339264
Tested: built from local changes and flashed successfully on machine
Change-Id: I18ee368bf3e8facb24c016af2f6cdf10c6ab634c
Signed-off-by: David Tang <davtang@google.com>
diff --git a/asset.cpp b/asset.cpp
index c74526e..8560ba2 100644
--- a/asset.cpp
+++ b/asset.cpp
@@ -34,8 +34,10 @@
namespace hoth
{
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
-using namespace internal;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
+using internal::EC_RES_SUCCESS;
+using internal::HostCommand;
+using internal::RspHeader;
namespace
{
diff --git a/asset.hpp b/asset.hpp
index 665cfe0..d87ae5e 100644
--- a/asset.hpp
+++ b/asset.hpp
@@ -36,7 +36,7 @@
sdbusplus::xyz::openbmc_project::Association::server::Definitions;
using AssetAssociationObject = ServerObject<AssetInterface, AssoInterface>;
-using namespace internal;
+using internal::HostCommand;
class Asset : public AssetAssociationObject
{
diff --git a/ec_util.cpp b/ec_util.cpp
index 477104a..05bd01d 100644
--- a/ec_util.cpp
+++ b/ec_util.cpp
@@ -34,7 +34,7 @@
{
namespace internal
{
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
namespace
{
diff --git a/ec_util.hpp b/ec_util.hpp
index 93c697f..02cf6d5 100644
--- a/ec_util.hpp
+++ b/ec_util.hpp
@@ -34,7 +34,7 @@
// Get the Hoth statistics by issuing an EC_PRV_CMD_HOTH_GET_STATISTICS
// Command.
- ec_response_statistics getHothStatistics() const;
+ ec_response_statistics getHothStatistics() const override;
// Get the Hoth persistent panic info by issuing a series of
// EC_PRV_CMD_HOTH_PERSISTENT_PANIC_INFO commands.
@@ -43,7 +43,7 @@
// Check the presence of Hoth peresistent panic info by issuing a single
// EC_PRV_CMD_HOTH_PERSISTENT_PANIC_INFO command.
- bool checkHothPersistentPanicInfo() const;
+ bool checkHothPersistentPanicInfo() const override;
private:
[[nodiscard]] static std::span<const uint8_t>
diff --git a/firmware_mtd_updater.cpp b/firmware_mtd_updater.cpp
index 9b52154..fef776d 100644
--- a/firmware_mtd_updater.cpp
+++ b/firmware_mtd_updater.cpp
@@ -27,7 +27,7 @@
{
namespace
{
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::FirmwareFailure;
constexpr char updatePartition[] = "hoth-update";
} // namespace
diff --git a/firmware_spi_updater.cpp b/firmware_spi_updater.cpp
index c173f35..2cf17ba 100644
--- a/firmware_spi_updater.cpp
+++ b/firmware_spi_updater.cpp
@@ -39,12 +39,14 @@
{
namespace
{
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using boost::endian::big_uint24_t;
+using boost::endian::big_uint32_t;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::FirmwareFailure;
// Each SPI erase size: 4096 bytes
constexpr uint16_t singleEraseSize = 4096;
// Each SPI write size: 256 bytes
-constexpr uint16_t singleWriteSize = 256;
+[[maybe_unused]] constexpr uint16_t singleWriteSize = 256;
// Each Read SPI read size set to 1000 bytes (mailbox is 1024 bytes)
constexpr uint16_t singleReadSize = 1000;
@@ -166,8 +168,9 @@
{
return;
}
+ const char* enclosingFuncName = __func__;
const std::optional<bool> sps_passthrough_mode =
- [this] -> std::optional<bool> {
+ [this, &enclosingFuncName] -> std::optional<bool> {
try
{
return fwUpdater->getSpsPassthrough();
@@ -177,7 +180,7 @@
stdplus::print(stderr,
"{}: Unable to check SPS passthrough status: {}. "
"Trying prepare: {}\n",
- __func__, e.what(), resetMode == ResetMode::ignore);
+ enclosingFuncName, e.what(), resetMode == ResetMode::ignore);
return std::nullopt;
}
}();
@@ -458,8 +461,8 @@
appendToByteArray(request, writeTx);
appendAddress(request, beginAddress);
// Write payload
- request.insert(request.end(), firmwareData.begin() + i,
- firmwareData.begin() + i + payloadSize);
+ request.insert(request.end(), firmwareData.begin() + static_cast<int64_t>(i),
+ firmwareData.begin() + static_cast<int64_t>(i) + payloadSize);
std::vector<uint8_t> response = hostCmd->sendCommand(
EC_CMD_BOARD_SPECIFIC_BASE | EC_PRV_CMD_HOTH_SPI_OPERATION, 0,
diff --git a/firmware_spi_updater.hpp b/firmware_spi_updater.hpp
index c5e4b2d..a95ad85 100644
--- a/firmware_spi_updater.hpp
+++ b/firmware_spi_updater.hpp
@@ -20,6 +20,7 @@
#include <boost/endian/arithmetic.hpp>
#include <array>
+#include <cstdint>
namespace google
{
@@ -27,7 +28,8 @@
{
namespace internal
{
-using namespace boost::endian;
+using boost::endian::little_uint16_t;
+using boost::endian::little_uint32_t;
/** @brief Equivalent of `hoth_update_region_response` in
* google3/host_commands.h
@@ -57,7 +59,7 @@
little_uint16_t misoLen;
};
-enum class ResetMode
+enum class ResetMode : uint8_t
{
needed,
never,
@@ -100,7 +102,7 @@
* @param[in] targetReset - Whether to reset target
* @param[in] ignoreAddressMode - Ignore address mode change failure
*/
- FirmwareSpiUpdater(HostCommand* hostCmd, uint8_t addressSize = 4,
+ explicit FirmwareSpiUpdater(HostCommand* hostCmd, uint8_t addressSize = 4,
ResetMode targetReset = ResetMode::never,
bool ignoreAddressMode = false);
diff --git a/host_command.cpp b/host_command.cpp
index a027dda..cdfd07b 100644
--- a/host_command.cpp
+++ b/host_command.cpp
@@ -41,8 +41,10 @@
namespace internal
{
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
-using namespace sdbusplus::error::xyz::openbmc_project::common;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::CommandFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::InterfaceError;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
+using sdbusplus::error::xyz::openbmc_project::common::Timeout;
HostCommandImpl::HostCommandImpl(MessageIntf* msg, boost::asio::io_context* io,
LogCollectorUtil* logCollectorUtil,
@@ -124,7 +126,7 @@
{
stdplus::println(stderr, "Long running command failed in hothd. "
"Triggering Hoth log collection...");
- collectHothLogsAsync(); // dump hoth logs
+ collectHothLogsAsync(true); // dump hoth logs
return generateErrorResponse(longRunning);
}
@@ -143,7 +145,7 @@
stdplus::println(
stderr,
"Command failure in hothd. Triggering Hoth Log collector...");
- collectHothLogsAsync(); // dump hoth logs
+ collectHothLogsAsync(true); // dump hoth logs
throw;
}
catch (...)
@@ -154,7 +156,7 @@
stdplus::println(
stderr, "Communication failed and all retries exhausted in "
"hothd. Triggering Hoth Log Collector...");
- collectHothLogsAsync(); // dump hoth logs
+ collectHothLogsAsync(true); // dump hoth logs
throw;
}
// We want to exponentially back off the interface as retries fail
diff --git a/host_command.hpp b/host_command.hpp
index c3c552f..1095526 100644
--- a/host_command.hpp
+++ b/host_command.hpp
@@ -83,19 +83,19 @@
* @return requestId: Every request would have a request id that the
* requester can use to wait on and cleanup later
*/
- int collectHothLogsAsync(bool cleanupPromiseAfterExecution = true);
+ int collectHothLogsAsync(bool cleanupPromiseAfterExecution) override;
/**
* @brief Triggers collect uart logs scheduler asynchronously. If the
* scheduler is already working (since it gets triggered on its own in
* constructor) this function does nothing.
*/
- void collectUartLogsAsync();
+ void collectUartLogsAsync() override;
/**
* @brief Stops the uart collector scheduler.
*/
- void stopUartLogs();
+ void stopUartLogs() override;
/**
* @brief When the requester wants to wait on the log collector request to
diff --git a/host_command_interface.hpp b/host_command_interface.hpp
index bbc9fc2..7b14fce 100644
--- a/host_command_interface.hpp
+++ b/host_command_interface.hpp
@@ -50,7 +50,7 @@
virtual std::vector<uint8_t> getResponse(uint64_t callToken) = 0;
virtual bool communicationFailure() const = 0;
virtual int
- collectHothLogsAsync(bool cleanupPromiseAfterExecution = true) = 0;
+ collectHothLogsAsync(bool cleanupPromiseAfterExecution) = 0;
virtual void collectUartLogsAsync() = 0;
diff --git a/hoth.cpp b/hoth.cpp
index 7b5fb9c..60d9e28 100644
--- a/hoth.cpp
+++ b/hoth.cpp
@@ -65,8 +65,19 @@
constexpr uint8_t kCryptaHostCommandVersion = 0x00;
} // namespace
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
-using namespace internal;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::CommandFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ExpectedInfoNotFound;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::FirmwareFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::InterfaceError;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
+using internal::CryptaHeader;
+using internal::CBKSlotCmd;
+using internal::EC_RES_ACCESS_DENIED;
+using internal::FirmwareUpdater;
+using internal::LoadTokenCmd;
+using internal::PayloadUpdate;
+using internal::ReqHeader;
+using internal::SUPPORTED_STRUCT_VERSION;
Hoth::FirmwareUpdateStatus Hoth::getAsyncStatus(std::future<void>* asyncFuture)
{
@@ -557,7 +568,7 @@
void Hoth::collectHothLogs()
{
- hostCmd->collectHothLogsAsync();
+ hostCmd->collectHothLogsAsync(true);
}
void Hoth::collectUartLogs()
diff --git a/hoth_state.cpp b/hoth_state.cpp
index ca18830..aead187 100644
--- a/hoth_state.cpp
+++ b/hoth_state.cpp
@@ -33,10 +33,6 @@
{
namespace hoth
{
-
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth::state;
-using namespace internal;
-
namespace
{
diff --git a/libusb.cpp b/libusb.cpp
index f27bbd8..412c23d 100644
--- a/libusb.cpp
+++ b/libusb.cpp
@@ -140,7 +140,7 @@
{
libusb_device_handle* handle;
callCheck("open", &LibusbIntf::open, libusb, *dev, &handle);
- return DeviceHandle(libusb, std::move(handle));
+ return DeviceHandle(libusb, handle);
}
void Device::drop(libusb_device*&& dev, LibusbIntf*& libusb)
@@ -156,7 +156,7 @@
std::vector<Device> ret;
for (size_t i = 0; devs[i] != nullptr; ++i)
{
- ret.push_back(Device(libusb, std::move(devs[i])));
+ ret.push_back(Device(libusb, devs[i]));
}
libusb->free_device_list(devs, 0);
return ret;
diff --git a/libusb.hpp b/libusb.hpp
index 4b2265c..116870f 100644
--- a/libusb.hpp
+++ b/libusb.hpp
@@ -83,8 +83,8 @@
class DeviceHandle
{
public:
- DeviceHandle(LibusbIntf* libusb, libusb_device_handle*&& handle) :
- libusb(libusb), handle(std::move(handle), libusb)
+ DeviceHandle(LibusbIntf* libusb, libusb_device_handle* handle) :
+ libusb(libusb), handle(handle, libusb)
{}
InterfaceClaim claim_interface(int interface);
unsigned bulk_transfer(const libusb_endpoint_descriptor& ep, uint8_t* data,
@@ -100,8 +100,8 @@
class Device
{
public:
- Device(LibusbIntf* libusb, libusb_device*&& dev) :
- libusb(libusb), dev(std::move(dev), libusb)
+ Device(LibusbIntf* libusb, libusb_device* dev) :
+ libusb(libusb), dev(dev, libusb)
{}
libusb_config_descriptor& get_active_config_descriptor();
uint8_t get_bus_number();
@@ -118,7 +118,7 @@
class Context
{
public:
- Context(LibusbIntf* libusb) : libusb(libusb), ctx(init(), libusb)
+ explicit Context(LibusbIntf* libusb) : libusb(libusb), ctx(init(), libusb)
{}
std::vector<Device> get_device_list();
diff --git a/log_collector_util.hpp b/log_collector_util.hpp
index 510f8e1..5117f10 100644
--- a/log_collector_util.hpp
+++ b/log_collector_util.hpp
@@ -60,7 +60,7 @@
{
namespace internal
{
-enum class PublishType
+enum class PublishType : uint8_t
{
Stderr,
File
@@ -73,7 +73,7 @@
class RateLimiter
{
public:
- RateLimiter(int rateLimitInMilliseconds) :
+ explicit RateLimiter(int rateLimitInMilliseconds) :
rateLimitInMilliseconds(rateLimitInMilliseconds)
{
std::chrono::hours one_day(24);
diff --git a/main.cpp b/main.cpp
index e04e1c8..4aa70e3 100644
--- a/main.cpp
+++ b/main.cpp
@@ -65,8 +65,9 @@
constexpr static const char* kConfigPathPrefix =
"xyz.openbmc_project.Configuration.Hoth";
+// NOLINTNEXTLINE(google-build-using-namespace)
using namespace std::string_literals;
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::InterfaceError;
using Value = std::variant<std::monostate>;
using ObjectType =
@@ -268,7 +269,7 @@
}
// To facilitate debugging Hoth errors, emit a snapshot of its console.
- hostCmd->collectHothLogsAsync();
+ hostCmd->collectHothLogsAsync(true);
}
catch (const std::exception& e)
{
diff --git a/message_file.cpp b/message_file.cpp
index 723f225..755301d 100644
--- a/message_file.cpp
+++ b/message_file.cpp
@@ -44,7 +44,7 @@
void MessageFile::send(const uint8_t* buf, size_t size, size_t seek)
{
- if (sys->lseek(fd, seek, SEEK_SET) < 0)
+ if (sys->lseek(fd, static_cast<off_t>(seek), SEEK_SET) < 0)
{
throw internal::errnoException("Error seeking on Hoth interface");
}
@@ -72,7 +72,7 @@
void MessageFile::recv(uint8_t* buf, size_t size, size_t seek)
{
- if (sys->lseek(fd, seek, SEEK_SET) < 0)
+ if (sys->lseek(fd, static_cast<off_t>(seek), SEEK_SET) < 0)
{
throw internal::errnoException("Error seeking on Hoth interface");
}
diff --git a/message_file.hpp b/message_file.hpp
index 66d4e97..57b0e37 100644
--- a/message_file.hpp
+++ b/message_file.hpp
@@ -27,7 +27,7 @@
public:
explicit MessageFile(const std::string& path,
const internal::Sys* sys = &internal::sys_impl);
- ~MessageFile();
+ ~MessageFile() override;
/* Delete the copy constructor and copy assignment operator because the fd
* must be unique.
diff --git a/message_hoth_usb.hpp b/message_hoth_usb.hpp
index bf224ca..cf165c2 100644
--- a/message_hoth_usb.hpp
+++ b/message_hoth_usb.hpp
@@ -44,7 +44,7 @@
void send(const uint8_t* buf, size_t size, size_t seek) override;
void recv(uint8_t* buf, size_t size, size_t seek) override;
- ~MessageHothUSB();
+ ~MessageHothUSB() override;
private:
LibusbIntf* libusb_;
diff --git a/message_util.cpp b/message_util.cpp
index 51cc049..454c671 100644
--- a/message_util.cpp
+++ b/message_util.cpp
@@ -28,7 +28,8 @@
namespace internal
{
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::CommandFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
void populateReqHeader(uint16_t command, uint8_t command_version,
const void* request, size_t request_size,
diff --git a/message_util.hpp b/message_util.hpp
index 154a77e..6b3a3e3 100644
--- a/message_util.hpp
+++ b/message_util.hpp
@@ -30,7 +30,9 @@
uint8_t constexpr SUPPORTED_STRUCT_VERSION = 3;
-using namespace boost::endian;
+using boost::endian::little_uint8_t;
+using boost::endian::little_uint16_t;
+using boost::endian::little_uint32_t;
struct ReqHeader
{
diff --git a/payload_update.cpp b/payload_update.cpp
index 7b1f4c5..f13d039 100644
--- a/payload_update.cpp
+++ b/payload_update.cpp
@@ -28,6 +28,7 @@
#include <xyz/openbmc_project/Control/Hoth/error.hpp>
#include <array>
+#include <cstdint>
#include <format>
#include <memory>
#include <span>
@@ -41,7 +42,7 @@
namespace internal
{
-enum hoth_status
+enum hoth_status : uint16_t
{
/*
There is no update payload pending confirmation
@@ -49,7 +50,7 @@
HOTH_PAYLOAD_UPDATE_CONFIRM_NO_PENDING_PAYLOAD = 0xD004,
};
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
void PayloadUpdateImpl::initiate() const
{
@@ -87,7 +88,7 @@
// Find the nearest aligned address to the end of the file. We can't
// assume that the file-size is aligned.
ssize_t offset =
- (fsize / kImageDescriptorAlignment) * kImageDescriptorAlignment;
+ static_cast<ssize_t>((fsize / kImageDescriptorAlignment) * kImageDescriptorAlignment);
if (offset + sizeof(kDescriptorMagic) > fsize)
{
offset -= kImageDescriptorAlignment;
diff --git a/payload_update.hpp b/payload_update.hpp
index f7a5f2b..67cfb5a 100644
--- a/payload_update.hpp
+++ b/payload_update.hpp
@@ -84,9 +84,9 @@
std::optional<payload_update_confirm_response>
confirm(enum payload_update_confirm_option option, uint32_t timeout,
uint64_t confirmation_cookie) const override;
- bool findDescriptor(const std::string& path, uint32_t* desc_offset) const;
+ bool findDescriptor(const std::string& path, uint32_t* desc_offset) const override;
void eraseAndSendStaticWPRegions(const std::string& path,
- uint32_t desc_offset) const;
+ uint32_t desc_offset) const override;
// Arbitrarily picked due to the performance of the calls taking ~0.4s
static constexpr size_t verify_size = 512 * 1024;
diff --git a/payload_update_interface.hpp b/payload_update_interface.hpp
index e537d6d..771a07b 100644
--- a/payload_update_interface.hpp
+++ b/payload_update_interface.hpp
@@ -31,14 +31,14 @@
/* Side represents one half of an A/B update scheme. This is typically the
* Hoth payload update scheme, but can be used for other similar uses.
*/
-enum class Side
+enum class Side : uint8_t
{
A = 0,
B = 1,
};
/* Whether or not a payload update is persistent.
*/
-enum class Persistence
+enum class Persistence : uint8_t
{
kNonPersistent = 0,
kPersistent = 1,
diff --git a/sys.cpp b/sys.cpp
index f96dc1f..af9611d 100644
--- a/sys.cpp
+++ b/sys.cpp
@@ -14,6 +14,7 @@
#include "sys.hpp"
+#include <cstdint>
#include <fcntl.h>
#include <mtd/mtd-user.h>
#include <sys/ioctl.h>
@@ -51,7 +52,7 @@
return ::write(fd, buf, count);
}
-int SysImpl::ioctl(int fd, unsigned long request, void* mtd) const
+int SysImpl::ioctl(int fd, uint64_t request, void* mtd) const
{
return ::ioctl(fd, request, mtd);
}
diff --git a/sys.hpp b/sys.hpp
index 558284a..5016a66 100644
--- a/sys.hpp
+++ b/sys.hpp
@@ -16,6 +16,7 @@
#include "sys_interface.hpp"
+#include <cstdint>
#include <mtd/mtd-user.h>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -41,7 +42,7 @@
off_t lseek(int fd, off_t offset, int whence) const override;
ssize_t read(int fd, void* buf, size_t count) const override;
ssize_t write(int fd, const void* buf, size_t count) const override;
- int ioctl(int, unsigned long, void*) const override;
+ int ioctl(int fd, uint64_t request, void* mtd) const override;
};
inline std::system_error errnoException(const std::string& message)
diff --git a/sys_interface.hpp b/sys_interface.hpp
index 85f00f4..dc0b0bc 100644
--- a/sys_interface.hpp
+++ b/sys_interface.hpp
@@ -14,6 +14,7 @@
#pragma once
+#include <cstdint>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -39,7 +40,7 @@
virtual off_t lseek(int fd, off_t offset, int whence) const = 0;
virtual ssize_t read(int fd, void* buf, size_t count) const = 0;
virtual ssize_t write(int fd, const void* buf, size_t count) const = 0;
- virtual int ioctl(int, unsigned long, void*) const = 0;
+ virtual int ioctl(int fd , uint64_t request, void* mtd) const = 0;
};
} // namespace internal
diff --git a/test/ec_util_unittest.cpp b/test/ec_util_unittest.cpp
index ba08336..d9ad71f 100644
--- a/test/ec_util_unittest.cpp
+++ b/test/ec_util_unittest.cpp
@@ -23,8 +23,9 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+// NOLINTNEXTLINE(google-build-using-namespace)
using namespace std::literals;
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
using ::testing::_;
using ::testing::Return;
diff --git a/test/firmware_mtd_updater_unittest.cpp b/test/firmware_mtd_updater_unittest.cpp
index 0e3fcb6..7ecabab 100644
--- a/test/firmware_mtd_updater_unittest.cpp
+++ b/test/firmware_mtd_updater_unittest.cpp
@@ -21,9 +21,10 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
-using namespace google::hoth;
-using namespace google::hoth::internal;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::FirmwareFailure;
+using google::hoth::internal::FirmwareMtdUpdater;
+using google::hoth::internal::MtdMock;
+using google::hoth::internal::SysMock;
using ::testing::_;
using ::testing::Return;
@@ -32,10 +33,10 @@
{
protected:
// Mtd mock object
- internal::MtdMock mtd;
+ MtdMock mtd;
// Sys mock object
- internal::SysMock sys;
+ SysMock sys;
};
TEST_F(FirmwareMtdUpdaterTest, noMtd)
diff --git a/test/firmware_spi_updater_unittest.cpp b/test/firmware_spi_updater_unittest.cpp
index 5ef36b4..169e90a 100644
--- a/test/firmware_spi_updater_unittest.cpp
+++ b/test/firmware_spi_updater_unittest.cpp
@@ -25,9 +25,10 @@
#include <cstring>
-using namespace google::hoth;
-using namespace google::hoth::internal;
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using google::hoth::internal::FirmwareSpiUpdater;
+using google::hoth::internal::HostCommandMock;
+using google::hoth::internal::ResetMode;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::FirmwareFailure;
using ::testing::_;
using ::testing::Return;
@@ -36,7 +37,7 @@
{
protected:
// Host Command interface handle
- internal::HostCommandMock hostCmd;
+ HostCommandMock hostCmd;
std::vector<uint8_t> hothGetRegionResponse = {
0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // Header
diff --git a/test/host_command_unittest.cpp b/test/host_command_unittest.cpp
index ff719f7..fe54040 100644
--- a/test/host_command_unittest.cpp
+++ b/test/host_command_unittest.cpp
@@ -34,10 +34,21 @@
#include <gtest/gtest.h>
using namespace std::literals;
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
-using namespace sdbusplus::error::xyz::openbmc_project::common;
-using namespace google::hoth;
-using namespace google::hoth::internal;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::CommandFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::InterfaceError;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
+using sdbusplus::error::xyz::openbmc_project::common::Timeout;
+using google::hoth::MessageIntf;
+using google::hoth::internal::EC_RES_ACCESS_DENIED;
+using google::hoth::internal::EC_RES_SUCCESS;
+using google::hoth::internal::EC_RES_INVALID_PARAM;
+using google::hoth::internal::HostCommandImpl;
+using google::hoth::internal::LogCollectorUtil;
+using google::hoth::internal::MessageMock;
+using google::hoth::internal::RateLimiter;
+using google::hoth::internal::ReqHeader;
+using google::hoth::internal::SUPPORTED_STRUCT_VERSION;
+
using ::testing::_;
using ::testing::ContainerEq;
@@ -84,7 +95,7 @@
TEST(HothLogCollector, TriggerLogCollector)
{
- testing::StrictMock<internal::MessageMock> msg;
+ testing::StrictMock<MessageMock> msg;
boost::asio::io_context io;
RateLimiter rateLimiter(kRateLimiterMilliSeconds);
LogCollectorUtil logCollectorUtil(rateLimiter, kTestAsyncWaitTimeInSeconds);
@@ -103,7 +114,7 @@
TEST(UartLogCollector, TriggerLogCollector)
{
- testing::StrictMock<internal::MessageMock> msg;
+ testing::StrictMock<MessageMock> msg;
boost::asio::io_context io;
RateLimiter rateLimiter(kRateLimiterMilliSeconds);
LogCollectorUtil logCollectorUtil(rateLimiter, 1);
@@ -148,7 +159,7 @@
TEST(UartLogCollector, GetChannelWriteOffsetThrowsException)
{
- testing::StrictMock<internal::MessageMock> msg;
+ testing::StrictMock<MessageMock> msg;
boost::asio::io_context io;
RateLimiter rateLimiter(kRateLimiterMilliSeconds);
LogCollectorUtil logCollectorUtil(rateLimiter, 1);
@@ -172,7 +183,7 @@
TEST(UartLogCollector, LogBufferRetrievalThrowsException)
{
- testing::StrictMock<internal::MessageMock> msg;
+ testing::StrictMock<MessageMock> msg;
boost::asio::io_context io;
RateLimiter rateLimiter(kRateLimiterMilliSeconds);
LogCollectorUtil logCollectorUtil(rateLimiter, 1);
@@ -329,12 +340,12 @@
}
// Message interface handle
- internal::MessageMock msg;
+ MessageMock msg;
// Host Command interface handle
RateLimiter rateLimiter;
LogCollectorUtil logCollectorUtil;
- internal::HostCommandImpl hostCmd;
+ HostCommandImpl hostCmd;
};
TEST_F(HostCommandTest, syncBlocked)
@@ -620,11 +631,11 @@
// Ensures that a failure in sending a command will be retried at least once
// by having the first send to the hoth mailbox fail, then allowing the
// subsequent send / recv to succeed like normal.
- internal::MessageMock msg;
+ MessageMock msg;
boost::asio::io_context io;
RateLimiter rateLimiter(kRateLimiterMilliSeconds);
LogCollectorUtil logCollectorUtil(rateLimiter, kTestAsyncWaitTimeInSeconds);
- internal::HostCommandImpl hostCmd(&msg, &io, &logCollectorUtil,
+ HostCommandImpl hostCmd(&msg, &io, &logCollectorUtil,
kEndpointTestName, 1, true);
{
@@ -642,11 +653,11 @@
{
// Ensures that a failure in sending a command will be retried only for the
// first set of failures.
- testing::StrictMock<internal::MessageMock> msg;
+ testing::StrictMock<MessageMock> msg;
boost::asio::io_context io;
RateLimiter rateLimiter(kRateLimiterMilliSeconds);
LogCollectorUtil logCollectorUtil(rateLimiter, kTestAsyncWaitTimeInSeconds);
- internal::HostCommandImpl hostCmd(&msg, &io, &logCollectorUtil,
+ HostCommandImpl hostCmd(&msg, &io, &logCollectorUtil,
kEndpointTestName, 2, true);
EXPECT_FALSE(hostCmd.communicationFailure());
diff --git a/test/hoth_unittest.cpp b/test/hoth_unittest.cpp
index dc315a2..2a4cc83 100644
--- a/test/hoth_unittest.cpp
+++ b/test/hoth_unittest.cpp
@@ -30,9 +30,18 @@
#include <gtest/gtest.h>
using namespace std::literals;
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
-using namespace google::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::CommandFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ExpectedInfoNotFound;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::FirmwareFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::InterfaceError;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
+using google::hoth::Hoth;
+using google::hoth::internal::FirmwareUpdater;
+using google::hoth::internal::FirmwareMtdUpdater;
+using google::hoth::internal::Persistence;
+using google::hoth::internal::Side;
+using ::testing::_;
using ::testing::ContainerEq;
using ::testing::InSequence;
using ::testing::InvokeWithoutArgs;
@@ -80,8 +89,8 @@
// Ensure that calls to updateFirmware() and getFirmwareUpdateStatus()
// return proper errors in the case that we don't support the mtd firmware
// update protocol.
- std::unique_ptr<internal::FirmwareUpdater> firmwareUpdater =
- std::make_unique<internal::FirmwareMtdUpdater>(nullptr, nullptr);
+ std::unique_ptr<FirmwareUpdater> firmwareUpdater =
+ std::make_unique<FirmwareMtdUpdater>(nullptr, nullptr);
sdbusplus::SdBusMock sdbus_mock;
sdbusplus::bus::bus bus = sdbusplus::get_mocked_new(&sdbus_mock);
std::unique_ptr<Hoth> hoth = std::make_unique<Hoth>(
@@ -863,8 +872,8 @@
EXPECT_CALL(payloadUpdate, getStatus()).WillOnce(Return(expectedResponse));
EXPECT_CALL(payloadUpdate,
- activate(internal::Side(otherHalf),
- internal::Persistence(expectedPersistence)))
+ activate(Side(otherHalf),
+ Persistence(expectedPersistence)))
.WillOnce(Return());
hoth->activatePayload(expectedPersistence);
@@ -883,8 +892,8 @@
expectedResponse.persistent_half = 0;
EXPECT_CALL(payloadUpdate, getStatus()).WillOnce(Return(expectedResponse));
- EXPECT_CALL(payloadUpdate, activate(internal::Side(activeHalf),
- internal::Persistence(true)))
+ EXPECT_CALL(payloadUpdate, activate(Side(activeHalf),
+ Persistence(true)))
.WillOnce(Return());
hoth->deactivatePayload();
diff --git a/test/hoth_unittest.hpp b/test/hoth_unittest.hpp
index 399322f..642792d 100644
--- a/test/hoth_unittest.hpp
+++ b/test/hoth_unittest.hpp
@@ -29,13 +29,6 @@
#include <gtest/gtest.h>
-using namespace google::hoth;
-
-using ::testing::_;
-using ::testing::IsNull;
-using ::testing::Return;
-using ::testing::StrEq;
-
class HothTest : public ::testing::Test
{
protected:
@@ -45,11 +38,15 @@
HothTest() :
bus(sdbusplus::get_mocked_new(&sdbus_mock)),
firmwareUpdater(
- std::make_unique<internal::FirmwareMtdUpdater>(&mtd, &sys)),
+ std::make_unique<google::hoth::internal::FirmwareMtdUpdater>(&mtd, &sys)),
// Need to set up the expectations before constructing the Hoth object
- hoth(std::make_unique<Hoth>(bus, TEST_PATH, &hostCmd, &payloadUpdate,
+ hoth(std::make_unique<google::hoth::Hoth>(bus, TEST_PATH, &hostCmd, &payloadUpdate,
&ecUtil, firmwareUpdater.get()))
{
+ using ::testing::_;
+ using ::testing::IsNull;
+ using ::testing::Return;
+ using ::testing::StrEq;
EXPECT_CALL(sdbus_mock,
sd_bus_emit_object_added(IsNull(), StrEq(TEST_PATH)))
.WillRepeatedly(Return(0));
@@ -71,23 +68,23 @@
sdbusplus::bus::bus bus;
// Host Command interface handle
- internal::HostCommandMock hostCmd;
+ google::hoth::internal::HostCommandMock hostCmd;
// Host Command interface handle
- internal::PayloadUpdateMock payloadUpdate;
+ google::hoth::internal::PayloadUpdateMock payloadUpdate;
// EC Utility interface handle
- internal::EcUtilMock ecUtil;
+ google::hoth::internal::EcUtilMock ecUtil;
// Mtd mock object
- internal::MtdMock mtd;
+ google::hoth::internal::MtdMock mtd;
// Sys mock object
- internal::SysMock sys;
+ google::hoth::internal::SysMock sys;
// FirmwareUpdater interface handle
- std::unique_ptr<internal::FirmwareUpdater> firmwareUpdater = nullptr;
+ std::unique_ptr<google::hoth::internal::FirmwareUpdater> firmwareUpdater = nullptr;
// Hoth object
- std::unique_ptr<Hoth> hoth = nullptr;
+ std::unique_ptr<google::hoth::Hoth> hoth = nullptr;
};
diff --git a/test/log_collector_util_test.cpp b/test/log_collector_util_test.cpp
index 20cc043..35e344c 100644
--- a/test/log_collector_util_test.cpp
+++ b/test/log_collector_util_test.cpp
@@ -21,8 +21,9 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-using namespace google::hoth;
-using namespace google::hoth::internal;
+using google::hoth::internal::LogCollectorUtil;
+using google::hoth::internal::RateLimiter;
+using google::hoth::internal::RspHeader;
class LogCollectorUtilTest : public ::testing::Test
{
diff --git a/test/message_file_unittest.cpp b/test/message_file_unittest.cpp
index 327aefc..a763aa1 100644
--- a/test/message_file_unittest.cpp
+++ b/test/message_file_unittest.cpp
@@ -26,8 +26,11 @@
using ::testing::NotNull;
using ::testing::Return;
using ::testing::SetErrnoAndReturn;
+using ::testing::StrEq;
using ::testing::WithArgs;
+using google::hoth::MessageFile;
+
auto static const test_str = "Hello, world!"s;
std::vector<uint8_t> static const test_buf(test_str.begin(), test_str.end());
auto static const test2_str = "Good morning, world!"s;
@@ -128,7 +131,7 @@
TEST_F(MessageFileTest, recvSeek)
{
size_t seek = 1;
- std::vector<uint8_t> trunc_buf(test_buf.cbegin() + seek, test_buf.cend());
+ std::vector<uint8_t> trunc_buf(test_buf.cbegin() + static_cast<int64_t>(seek), test_buf.cend());
EXPECT_CALL(sys, lseek(TEST_FD, seek, SEEK_SET));
EXPECT_CALL(sys, read(TEST_FD, NotNull(), _))
diff --git a/test/message_file_unittest.hpp b/test/message_file_unittest.hpp
index 545da57..707eb7f 100644
--- a/test/message_file_unittest.hpp
+++ b/test/message_file_unittest.hpp
@@ -23,26 +23,21 @@
#include <gmock/gmock.h>
-using namespace google::hoth;
-
-using ::testing::Return;
-using ::testing::StrEq;
-
class MessageFileTest : public ::testing::Test
{
protected:
MessageFileTest()
{
- EXPECT_CALL(sys, open(StrEq(TEST_PATH), O_RDWR))
- .WillOnce(Return(TEST_FD));
+ EXPECT_CALL(sys, open(::testing::StrEq(TEST_PATH), O_RDWR))
+ .WillOnce(::testing::Return(TEST_FD));
EXPECT_CALL(sys, close(TEST_FD));
- file = std::make_unique<MessageFile>(std::string(TEST_PATH), &sys);
+ file = std::make_unique<google::hoth::MessageFile>(std::string(TEST_PATH), &sys);
}
- const internal::SysMock sys;
+ const google::hoth::internal::SysMock sys;
- std::unique_ptr<MessageFile> file = nullptr;
+ std::unique_ptr<google::hoth::MessageFile> file = nullptr;
auto static constexpr TEST_FD = 42;
auto static constexpr TEST_PATH = "/test/path";
diff --git a/test/message_util_unittest.cpp b/test/message_util_unittest.cpp
index 9a29694..3462c05 100644
--- a/test/message_util_unittest.cpp
+++ b/test/message_util_unittest.cpp
@@ -24,8 +24,15 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-using namespace google::hoth::internal;
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using google::hoth::internal::calculateChecksum;
+using google::hoth::internal::populateReqHeader;
+using google::hoth::internal::ReqHeader;
+using google::hoth::internal::reqLen;
+using google::hoth::internal::RspHeader;
+using google::hoth::internal::rspLen;
+using google::hoth::internal::SUPPORTED_STRUCT_VERSION;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::CommandFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
namespace
{
diff --git a/test/mtd_util_unittest.cpp b/test/mtd_util_unittest.cpp
index e60b1dc..ad6fa28 100644
--- a/test/mtd_util_unittest.cpp
+++ b/test/mtd_util_unittest.cpp
@@ -31,7 +31,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-using namespace google::hoth;
+// NOLINTNEXTLINE(google-build-using-namespace)
using namespace std::literals;
namespace fs = std::filesystem;
diff --git a/test/mtd_util_unittest.hpp b/test/mtd_util_unittest.hpp
index 376e8e9..174cb5a 100644
--- a/test/mtd_util_unittest.hpp
+++ b/test/mtd_util_unittest.hpp
@@ -18,15 +18,12 @@
#include <gtest/gtest.h>
-using namespace google::hoth;
-
class FlashCopyTest : public ::testing::Test
{
protected:
- FlashCopyTest()
- {}
+ FlashCopyTest() = default;
- const internal::SysMock sys;
+ const google::hoth::internal::SysMock sys;
auto static constexpr TEST_PATH = "/test/path";
auto static constexpr TEST_FD = 3;
};
@@ -36,6 +33,5 @@
public ::testing::WithParamInterface<std::pair<uint32_t, bool>>
{
public:
- FlashCopyFakeTest()
- {}
+ FlashCopyFakeTest() = default;
};
diff --git a/test/payload_update_unittest.cpp b/test/payload_update_unittest.cpp
index dc4f9c4..e187808 100644
--- a/test/payload_update_unittest.cpp
+++ b/test/payload_update_unittest.cpp
@@ -36,7 +36,8 @@
#include <gtest/gtest.h>
using namespace std::literals;
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::CommandFailure;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
using ::testing::_;
using ::testing::ContainerEq;
diff --git a/tools/hoth_updater_cli.cpp b/tools/hoth_updater_cli.cpp
index d97830d..01bd1b1 100644
--- a/tools/hoth_updater_cli.cpp
+++ b/tools/hoth_updater_cli.cpp
@@ -236,8 +236,6 @@
}
}
-using namespace boost::endian;
-
HothVersionStringsRsp HothUpdaterCLI::getHothVersion(sdbusplus::bus::bus& bus,
std::string_view hoth_id)
{
diff --git a/tools/hoth_updater_cli.hpp b/tools/hoth_updater_cli.hpp
index 71aa5de..440d28a 100644
--- a/tools/hoth_updater_cli.hpp
+++ b/tools/hoth_updater_cli.hpp
@@ -26,7 +26,6 @@
#include <string>
#include <vector>
-using namespace boost::endian;
using FirmwareUpdateStatus = sdbusplus::xyz::openbmc_project::Control::server::
Hoth::FirmwareUpdateStatus;
@@ -53,7 +52,7 @@
char version_string_ro[32];
char version_string_rw[32];
char reserved[32]; // Was previously RW-B string
- little_uint32_t current_image; // One of ec_current_image
+ boost::endian::little_uint32_t current_image; // One of ec_current_image
};
struct HothVersionStringsRsp
@@ -74,8 +73,7 @@
class HothUpdaterCLI
{
public:
- virtual ~HothUpdaterCLI()
- {}
+ virtual ~HothUpdaterCLI() = default;
static void updateFirmware(sdbusplus::bus::bus &bus,
std::string_view hoth_id,
std::span<const uint8_t> image);
diff --git a/tools/payload_update_common.hpp b/tools/payload_update_common.hpp
index 6af0aa3..d545b36 100644
--- a/tools/payload_update_common.hpp
+++ b/tools/payload_update_common.hpp
@@ -14,33 +14,34 @@
#pragma once
+#include <cstdint>
#include <string>
namespace google::hoth::tools
{
namespace payload_update
{
-enum class SubCommandType
+enum class SubCommandType : uint8_t
{
kNop,
kVersion,
kUpdate,
};
-enum class VersionType
+enum class VersionType : uint8_t
{
kActiveHalf,
kNextHalf,
};
-enum class ResetMode
+enum class ResetMode : uint8_t
{
kNeeded,
kNever,
kIgnore,
};
-enum class UpdateMode
+enum class UpdateMode : uint8_t
{
kUpdateAll,
kUpdateStaticWPRegions,
diff --git a/tools/payload_update_main.cpp b/tools/payload_update_main.cpp
index 2960a19..ba094d1 100644
--- a/tools/payload_update_main.cpp
+++ b/tools/payload_update_main.cpp
@@ -23,8 +23,10 @@
int main(int argc, char* argv[])
{
- using namespace google::hoth::tools;
- auto cli = payload_update::PayloadUpdateCLI(
+ using google::hoth::tools::CLIParser;
+ using google::hoth::tools::HothDBus;
+ using google::hoth::tools::payload_update::PayloadUpdateCLI;
+ auto cli = PayloadUpdateCLI(
std::make_unique<CLIParser>(argc, argv), std::make_unique<HothDBus>());
if (!cli.getOptions())
{
diff --git a/tools/test/fake_bus.hpp b/tools/test/fake_bus.hpp
index 885bd24..84570c5 100644
--- a/tools/test/fake_bus.hpp
+++ b/tools/test/fake_bus.hpp
@@ -70,7 +70,7 @@
bool setSpsPassthrough(const std::string& hothId,
bool enable) override;
std::optional<bool> getSpsPassthrough(const std::string& hothId) override;
- bool expectConfirmPayload()
+ bool expectConfirmPayload() override
{
return true;
}
diff --git a/tools/test/payload_update_cli_parser_test.cpp b/tools/test/payload_update_cli_parser_test.cpp
index 19f001d..d766bdb 100644
--- a/tools/test/payload_update_cli_parser_test.cpp
+++ b/tools/test/payload_update_cli_parser_test.cpp
@@ -42,7 +42,7 @@
"update", payloadPath, "--reset"};
std::ofstream payloadFile(payloadPath, std::ios::binary);
std::vector<uint8_t> bytes{0, 1, 2, 3, 4, 5, 6, 7};
- payloadFile.write(reinterpret_cast<char*>(bytes.data()), bytes.size());
+ payloadFile.write(reinterpret_cast<char*>(bytes.data()), static_cast<int64_t>(bytes.size()));
payloadFile.close();
auto parser = std::make_unique<CLIParser>(sizeof(argv) / sizeof(argv[0]),
(char**)argv);
@@ -58,7 +58,7 @@
};
std::ofstream payloadFile(payloadPath, std::ios::binary);
std::vector<uint8_t> bytes{0, 1, 2, 3, 4, 5, 6, 7};
- payloadFile.write(reinterpret_cast<char*>(bytes.data()), bytes.size());
+ payloadFile.write(reinterpret_cast<char*>(bytes.data()),static_cast<int64_t>( bytes.size()));
payloadFile.close();
auto parser = std::make_unique<CLIParser>(sizeof(argv) / sizeof(argv[0]),
(char**)argv);
@@ -104,7 +104,7 @@
"update", payloadPath, "--reset"};
std::ofstream payloadFile(payloadPath, std::ios::binary);
std::vector<uint8_t> bytes{0, 1, 2, 3, 4, 5, 6, 7};
- payloadFile.write(reinterpret_cast<char*>(bytes.data()), bytes.size());
+ payloadFile.write(reinterpret_cast<char*>(bytes.data()), static_cast<int64_t>(bytes.size()));
payloadFile.close();
auto parser = std::make_unique<CLIParser>(sizeof(argv) / sizeof(argv[0]),
(char**)argv);
@@ -119,7 +119,7 @@
const char* argv[] = {"exe", "-i", "vxc3", "update", payloadPath};
std::ofstream payloadFile(payloadPath, std::ios::binary);
std::vector<uint8_t> bytes{0, 1, 2, 3, 4, 5, 6, 7};
- payloadFile.write(reinterpret_cast<char*>(bytes.data()), bytes.size());
+ payloadFile.write(reinterpret_cast<char*>(bytes.data()), static_cast<int64_t>(bytes.size()));
payloadFile.close();
auto parser = std::make_unique<CLIParser>(sizeof(argv) / sizeof(argv[0]),
(char**)argv);
@@ -135,7 +135,7 @@
payloadPath, "--reset", "ignore_fail"};
std::ofstream payloadFile(payloadPath, std::ios::binary);
std::vector<uint8_t> bytes{0, 1, 2, 3, 4, 5, 6, 7};
- payloadFile.write(reinterpret_cast<char*>(bytes.data()), bytes.size());
+ payloadFile.write(reinterpret_cast<char*>(bytes.data()), static_cast<int64_t>(bytes.size()));
payloadFile.close();
auto parser = std::make_unique<CLIParser>(sizeof(argv) / sizeof(argv[0]),
(char**)argv);
diff --git a/usb_reset/utils.hpp b/usb_reset/utils.hpp
index 1de0a00..0fdfb9b 100644
--- a/usb_reset/utils.hpp
+++ b/usb_reset/utils.hpp
@@ -31,6 +31,7 @@
#include <sdbusplus/asio/object_server.hpp>
#include <sdbusplus/message/types.hpp>
+#include <cstdint>
#include <filesystem>
#include <functional>
#include <iostream>
@@ -67,7 +68,7 @@
return boost::replace_all_copy(sensorName, " ", "_");
}
-enum class PowerState
+enum class PowerState : uint8_t
{
on,
biosPost,
@@ -75,9 +76,9 @@
chassisOn
};
-bool isPowerOn(void);
-bool hasBiosPost(void);
-bool isChassisOn(void);
+bool isPowerOn();
+bool hasBiosPost();
+bool isChassisOn();
class PowerCallbackEntry;
diff --git a/version.cpp b/version.cpp
index 5919044..68d5763 100644
--- a/version.cpp
+++ b/version.cpp
@@ -31,8 +31,10 @@
{
namespace hoth
{
-using namespace sdbusplus::error::xyz::openbmc_project::control::hoth;
-using namespace internal;
+using sdbusplus::error::xyz::openbmc_project::control::hoth::ResponseFailure;
+using internal::EC_RES_SUCCESS;
+using internal::HostCommand;
+using internal::RspHeader;
static ec_response_get_version getHothVersion(HostCommand* hostCmd)
{
diff --git a/version.hpp b/version.hpp
index bbc00cd..d03c234 100644
--- a/version.hpp
+++ b/version.hpp
@@ -32,7 +32,7 @@
sdbusplus::xyz::openbmc_project::Software::server::Version;
using VersionObject = ServerObject<VersionInterface>;
-using namespace internal;
+using internal::HostCommand;
/** @class RoVersion
* @brief Software Version interface implementation for Ro Version.