remove IPMI_CC
Since IPMI_CC declared in api.h has been gradually deprecated,
this submission will use ipmi::cc in api.hpp instead.
Change-Id: I490c4e38869b4f59a9dc0645c28eb721eab72980
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/ethstats.cpp b/ethstats.cpp
index 36df0e8..56e2f89 100644
--- a/ethstats.cpp
+++ b/ethstats.cpp
@@ -79,7 +79,7 @@
{
std::fprintf(stderr, "*dataLen too small: %u\n",
static_cast<std::uint32_t>(reqLength));
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
}
// using struct prefix due to nature as c-style pod struct.
@@ -91,7 +91,7 @@
{
std::fprintf(stderr, "*dataLen too small: %u\n",
static_cast<std::uint32_t>(reqLength));
- return IPMI_CC_REQ_DATA_LEN_INVALID;
+ return ipmi::ccReqDataLenInvalid;
}
// Check the statistic to see if we recognize it.
@@ -99,7 +99,7 @@
if (stat == statLookup.end())
{
std::fprintf(stderr, "stat not known: 0x%x\n", request.statId);
- return IPMI_CC_INVALID_FIELD_REQUEST;
+ return ipmi::ccInvalidFieldRequest;
}
// The if_name handling plus a few other things was taken from the
@@ -122,14 +122,14 @@
if (name.find('/') != std::string::npos)
{
std::fprintf(stderr, "Invalid or illegal name: '%s'\n", name.c_str());
- return IPMI_CC_INVALID_FIELD_REQUEST;
+ return ipmi::ccInvalidFieldRequest;
}
std::string fullPath = buildPath(name, stat->second);
if (!handler->validIfNameAndField(fullPath))
{
- return IPMI_CC_INVALID_FIELD_REQUEST;
+ return ipmi::ccInvalidFieldRequest;
}
struct EthStatReply reply;
@@ -140,7 +140,7 @@
std::memcpy(&replyCmdBuf[0], &reply, sizeof(reply));
(*dataLen) = sizeof(reply);
- return IPMI_CC_OK;
+ return ipmi::ccSuccess;
}
} // namespace ethstats
diff --git a/ethstats.hpp b/ethstats.hpp
index 520ed15..9f2cd40 100644
--- a/ethstats.hpp
+++ b/ethstats.hpp
@@ -4,6 +4,8 @@
#include <ipmid/api.h>
+#include <ipmid/api-types.hpp>
+
#include <cstdint>
#include <string>
diff --git a/test/ethstats.cpp b/test/ethstats.cpp
index db60319..528b4b5 100644
--- a/test/ethstats.cpp
+++ b/test/ethstats.cpp
@@ -38,7 +38,7 @@
// Using StrictMock to ensure it isn't called.
StrictMock<HandlerMock> hMock;
- EXPECT_EQ(IPMI_CC_INVALID_FIELD_REQUEST,
+ EXPECT_EQ(ipmi::ccInvalidFieldRequest,
handleEthStatCommand(request.data(), reply, &dataLen, &hMock));
}
@@ -64,7 +64,7 @@
// Using StrictMock to ensure it isn't called.
StrictMock<HandlerMock> hMock;
- EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
+ EXPECT_EQ(ipmi::ccReqDataLenInvalid,
handleEthStatCommand(request.data(), reply, &dataLen, &hMock));
}
@@ -89,7 +89,7 @@
// Using StrictMock to ensure it isn't called.
StrictMock<HandlerMock> hMock;
- EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
+ EXPECT_EQ(ipmi::ccReqDataLenInvalid,
handleEthStatCommand(request.data(), reply, &dataLen, &hMock));
}
@@ -112,7 +112,7 @@
// Using StrictMock to ensure it isn't called.
StrictMock<HandlerMock> hMock;
- EXPECT_EQ(IPMI_CC_INVALID_FIELD_REQUEST,
+ EXPECT_EQ(ipmi::ccInvalidFieldRequest,
handleEthStatCommand(request.data(), reply, &dataLen, &hMock));
}
@@ -138,7 +138,7 @@
EXPECT_CALL(hMock, validIfNameAndField(StrEq(expectedPath)))
.WillOnce(Return(false));
- EXPECT_EQ(IPMI_CC_INVALID_FIELD_REQUEST,
+ EXPECT_EQ(ipmi::ccInvalidFieldRequest,
handleEthStatCommand(request.data(), reply, &dataLen, &hMock));
}
@@ -164,7 +164,7 @@
.WillOnce(Return(true));
EXPECT_CALL(hMock, readStatistic(StrEq(expectedPath))).WillOnce(Return(1));
- EXPECT_EQ(IPMI_CC_OK,
+ EXPECT_EQ(ipmi::ccSuccess,
handleEthStatCommand(request.data(), reply, &dataLen, &hMock));
struct EthStatReply expectedReply, realReply;