style change: lowerCamel
Methods in openbmc are lowercamel.
Change-Id: I57567b66acdc1fc618f3ca7d237455d55783630c
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/cable.cpp b/cable.cpp
index dd499f2..c0eac48 100644
--- a/cable.cpp
+++ b/cable.cpp
@@ -32,11 +32,11 @@
struct CableRequest
{
uint8_t subcommand;
- uint8_t if_name_len;
- uint8_t if_name[0];
+ uint8_t ifNameLength;
+ uint8_t ifName[0];
} __attribute__((packed));
-ipmi_ret_t CableCheck(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen,
+ipmi_ret_t cableCheck(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen,
const HandlerInterface* handler)
{
// There is an IPMI LAN channel statistics command which could be used for
@@ -46,7 +46,7 @@
// There is a link status file, but it is "unknown" to start with...
// The path we're checking: /sys/class/net/eth1/statistics/rx_packets
- // This command is expecting: [0x00][len][if_name]
+ // This command is expecting: [0x00][len][ifName]
if ((*dataLen) < sizeof(struct CableRequest) + sizeof(uint8_t))
{
std::fprintf(stderr, "Invalid command length: %u\n",
@@ -58,15 +58,15 @@
reinterpret_cast<const struct CableRequest*>(&reqBuf[0]);
// Sanity check the object contents.
- if (request->if_name_len == 0)
+ if (request->ifNameLength == 0)
{
std::fprintf(stderr, "Invalid string length: %d\n",
- request->if_name_len);
+ request->ifNameLength);
return IPMI_CC_REQ_DATA_LEN_INVALID;
}
// Verify the request buffer contains the object and the string.
- if ((*dataLen) < (sizeof(struct CableRequest) + request->if_name_len))
+ if ((*dataLen) < (sizeof(struct CableRequest) + request->ifNameLength))
{
std::fprintf(stderr, "*dataLen too small: %u\n",
static_cast<uint32_t>(*dataLen));
@@ -76,7 +76,7 @@
// Maximum length one can specify, plus null terminator.
char nameBuf[256] = {};
// Copy the string out of the request buffer.
- std::memcpy(&nameBuf[0], request->if_name, request->if_name_len);
+ std::memcpy(&nameBuf[0], request->ifName, request->ifNameLength);
std::string name = nameBuf;
int64_t count;
diff --git a/cable.hpp b/cable.hpp
index 1075b41..6e559c0 100644
--- a/cable.hpp
+++ b/cable.hpp
@@ -18,7 +18,7 @@
//
// Handle the cablecheck. Sys must supply which ethernet device they're
// interested in.
-ipmi_ret_t CableCheck(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen,
+ipmi_ret_t cableCheck(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen,
const HandlerInterface* handler = &handlerImpl);
} // namespace ipmi
diff --git a/cpld.cpp b/cpld.cpp
index c3689cd..77d55d6 100644
--- a/cpld.cpp
+++ b/cpld.cpp
@@ -45,7 +45,7 @@
//
// Handle reading the cpld version from the tmpfs.
//
-ipmi_ret_t CpldVersion(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t cpldVersion(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen, const HandlerInterface* handler)
{
struct CpldRequest request;
diff --git a/cpld.hpp b/cpld.hpp
index bfb09ba..5c747ed 100644
--- a/cpld.hpp
+++ b/cpld.hpp
@@ -10,7 +10,7 @@
{
// Given a cpld identifier, return a version if available.
-ipmi_ret_t CpldVersion(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t cpldVersion(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen,
const HandlerInterface* handler = &handlerImpl);
diff --git a/entity_name.cpp b/entity_name.cpp
index ac04275..9a62f81 100644
--- a/entity_name.cpp
+++ b/entity_name.cpp
@@ -43,18 +43,18 @@
struct GetEntityNameRequest
{
uint8_t subcommand;
- uint8_t entity_id;
- uint8_t entity_instance;
+ uint8_t entityId;
+ uint8_t entityInstance;
} __attribute__((packed));
struct GetEntityNameReply
{
uint8_t subcommand;
- uint8_t entity_name_len;
- uint8_t entity_name[0];
+ uint8_t entityNameLength;
+ uint8_t entityName[0];
} __attribute__((packed));
-ipmi_ret_t GetEntityName(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t getEntityName(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen, HandlerInterface* handler)
{
struct GetEntityNameRequest request;
@@ -71,7 +71,7 @@
try
{
entityName =
- handler->getEntityName(request.entity_id, request.entity_instance);
+ handler->getEntityName(request.entityId, request.entityInstance);
}
catch (const IpmiException& e)
{
@@ -89,8 +89,8 @@
auto reply = reinterpret_cast<struct GetEntityNameReply*>(&replyBuf[0]);
reply->subcommand = SysEntityName;
- reply->entity_name_len = entityName.length();
- std::memcpy(reply->entity_name, entityName.c_str(), entityName.length());
+ reply->entityNameLength = entityName.length();
+ std::memcpy(reply->entityName, entityName.c_str(), entityName.length());
(*dataLen) = length;
return IPMI_CC_OK;
diff --git a/entity_name.hpp b/entity_name.hpp
index cf35e0d..c04b996 100644
--- a/entity_name.hpp
+++ b/entity_name.hpp
@@ -11,7 +11,7 @@
// Handle the "entity id:entity instance" to entity name mapping command.
// Sys can query the entity name for a particular "entity id:entity instance".
-ipmi_ret_t GetEntityName(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t getEntityName(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen,
HandlerInterface* handler = &handlerImpl);
diff --git a/eth.cpp b/eth.cpp
index 080dd9c..2d21c57 100644
--- a/eth.cpp
+++ b/eth.cpp
@@ -40,7 +40,7 @@
#define MAX_IPMI_BUFFER 64
#endif
-ipmi_ret_t GetEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t getEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen, const HandlerInterface* handler)
{
if ((*dataLen) < sizeof(struct EthDeviceRequest))
@@ -69,8 +69,8 @@
auto reply = reinterpret_cast<struct EthDeviceReply*>(&replyBuf[0]);
reply->subcommand = SysGetEthDevice;
reply->channel = std::get<0>(details);
- reply->if_name_len = device.length();
- std::memcpy(reply->if_name, device.c_str(), device.length());
+ reply->ifNameLength = device.length();
+ std::memcpy(reply->ifName, device.c_str(), device.length());
(*dataLen) = sizeof(struct EthDeviceReply) + device.length();
diff --git a/eth.hpp b/eth.hpp
index e5b8079..fee363d 100644
--- a/eth.hpp
+++ b/eth.hpp
@@ -10,21 +10,21 @@
{
// The reply to the ethdevice command specifies the
-// IPMI channel number and the if_name used for the
+// IPMI channel number and the ifName used for the
// ncis connection.
struct EthDeviceReply
{
uint8_t subcommand;
uint8_t channel;
- // if_name_len doesn't include the null-terminator.
- uint8_t if_name_len;
- uint8_t if_name[0];
+ // ifNameLength doesn't include the null-terminator.
+ uint8_t ifNameLength;
+ uint8_t ifName[0];
} __attribute__((packed));
// Handle the eth query command.
-// Sys can query the if_name and IPMI channel of the BMC's NCSI ethernet
+// Sys can query the ifName and IPMI channel of the BMC's NCSI ethernet
// device.
-ipmi_ret_t GetEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t getEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen,
const HandlerInterface* handler = &handlerImpl);
diff --git a/main.cpp b/main.cpp
index fce8c54..372cc04 100644
--- a/main.cpp
+++ b/main.cpp
@@ -43,7 +43,7 @@
namespace ipmi
{
-static ipmi_ret_t HandleSysCommand(ipmi_cmd_t cmd, const uint8_t* reqBuf,
+static ipmi_ret_t handleSysCommand(ipmi_cmd_t cmd, const uint8_t* reqBuf,
uint8_t* replyCmdBuf, size_t* dataLen)
{
// Verify it's at least as long as it needs to be for a subcommand.
@@ -57,19 +57,19 @@
switch (reqBuf[0])
{
case SysCableCheck:
- return CableCheck(reqBuf, replyCmdBuf, dataLen);
+ return cableCheck(reqBuf, replyCmdBuf, dataLen);
case SysCpldVersion:
- return CpldVersion(reqBuf, replyCmdBuf, dataLen);
+ return cpldVersion(reqBuf, replyCmdBuf, dataLen);
case SysGetEthDevice:
- return GetEthDevice(reqBuf, replyCmdBuf, dataLen);
+ return getEthDevice(reqBuf, replyCmdBuf, dataLen);
case SysPsuHardReset:
- return PsuHardReset(reqBuf, replyCmdBuf, dataLen);
+ return psuHardReset(reqBuf, replyCmdBuf, dataLen);
case SysPcieSlotCount:
- return PcieSlotCount(reqBuf, replyCmdBuf, dataLen);
+ return pcieSlotCount(reqBuf, replyCmdBuf, dataLen);
case SysPcieSlotI2cBusMapping:
- return PcieSlotI2cBusMapping(reqBuf, replyCmdBuf, dataLen);
+ return pcieSlotI2cBusMapping(reqBuf, replyCmdBuf, dataLen);
case SysEntityName:
- return GetEntityName(reqBuf, replyCmdBuf, dataLen);
+ return getEntityName(reqBuf, replyCmdBuf, dataLen);
default:
std::fprintf(stderr, "Invalid subcommand: 0x%x\n", reqBuf[0]);
return IPMI_CC_INVALID;
@@ -87,7 +87,7 @@
oem::googOemNumber, oem::google::sysCmd);
oemRouter->registerHandler(oem::googOemNumber, oem::google::sysCmd,
- HandleSysCommand);
+ handleSysCommand);
}
} // namespace ipmi
diff --git a/pcie_i2c.cpp b/pcie_i2c.cpp
index 07b04b9..2ddfd06 100644
--- a/pcie_i2c.cpp
+++ b/pcie_i2c.cpp
@@ -59,7 +59,7 @@
uint8_t pcie_slot_name[0];
} __attribute__((packed));
-ipmi_ret_t PcieSlotCount(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t pcieSlotCount(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen, HandlerInterface* handler)
{
if ((*dataLen) < sizeof(struct PcieSlotCountRequest))
@@ -85,7 +85,7 @@
return IPMI_CC_OK;
}
-ipmi_ret_t PcieSlotI2cBusMapping(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t pcieSlotI2cBusMapping(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen, HandlerInterface* handler)
{
struct PcieSlotI2cBusMappingRequest request;
diff --git a/pcie_i2c.hpp b/pcie_i2c.hpp
index fb4e6d3..ef89865 100644
--- a/pcie_i2c.hpp
+++ b/pcie_i2c.hpp
@@ -11,13 +11,13 @@
// Handle the pcie slot count command.
// Sys can query the number of pcie slots.
-ipmi_ret_t PcieSlotCount(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t pcieSlotCount(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen,
HandlerInterface* handler = &handlerImpl);
// Handle the pcie slot to i2c bus mapping command.
// Sys can query which i2c bus is routed to which pcie slot.
-ipmi_ret_t PcieSlotI2cBusMapping(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t pcieSlotI2cBusMapping(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen,
HandlerInterface* handler = &handlerImpl);
diff --git a/psu.cpp b/psu.cpp
index 73d716d..a5abda5 100644
--- a/psu.cpp
+++ b/psu.cpp
@@ -28,7 +28,7 @@
namespace ipmi
{
-ipmi_ret_t PsuHardReset(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t psuHardReset(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen, const HandlerInterface* handler)
{
struct PsuResetRequest request;
diff --git a/psu.hpp b/psu.hpp
index 657b65c..d2c5fbe 100644
--- a/psu.hpp
+++ b/psu.hpp
@@ -17,7 +17,7 @@
} __attribute__((packed));
// Set a time-delayed PSU hard reset.
-ipmi_ret_t PsuHardReset(const uint8_t* reqBuf, uint8_t* replyBuf,
+ipmi_ret_t psuHardReset(const uint8_t* reqBuf, uint8_t* replyBuf,
size_t* dataLen,
const HandlerInterface* handler = &handlerImpl);
diff --git a/test/cable_unittest.cpp b/test/cable_unittest.cpp
index ed45c1b..b181584 100644
--- a/test/cable_unittest.cpp
+++ b/test/cable_unittest.cpp
@@ -27,7 +27,7 @@
HandlerMock hMock;
EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
- CableCheck(request.data(), reply, &dataLen, &hMock));
+ cableCheck(request.data(), reply, &dataLen, &hMock));
}
TEST(CableCommandTest, FailsLengthSanityCheck)
@@ -42,7 +42,7 @@
HandlerMock hMock;
EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
- CableCheck(request.data(), reply, &dataLen, &hMock));
+ cableCheck(request.data(), reply, &dataLen, &hMock));
}
TEST(CableCommandTest, LengthTooLongForPacket)
@@ -57,7 +57,7 @@
HandlerMock hMock;
EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
- CableCheck(request.data(), reply, &dataLen, &hMock));
+ cableCheck(request.data(), reply, &dataLen, &hMock));
}
TEST(CableCommandTest, ValidRequestValidReturn)
@@ -71,7 +71,7 @@
HandlerMock hMock;
EXPECT_CALL(hMock, getRxPackets(StrEq("a"))).WillOnce(Return(0));
- EXPECT_EQ(IPMI_CC_OK, CableCheck(request.data(), reply, &dataLen, &hMock));
+ EXPECT_EQ(IPMI_CC_OK, cableCheck(request.data(), reply, &dataLen, &hMock));
// Check results.
struct CableReply expectedReply, actualReply;
diff --git a/test/cpld_unittest.cpp b/test/cpld_unittest.cpp
index 1c6caa3..12a0444 100644
--- a/test/cpld_unittest.cpp
+++ b/test/cpld_unittest.cpp
@@ -25,7 +25,7 @@
HandlerMock hMock;
EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
- CpldVersion(request.data(), reply, &dataLen, &hMock));
+ cpldVersion(request.data(), reply, &dataLen, &hMock));
}
TEST(CpldCommandTest, ValidRequestReturnsHappy)
@@ -43,7 +43,7 @@
.WillOnce(Return(std::make_tuple(expectedMaj, expectedMin, expectedPt,
expectedSbPtr)));
- EXPECT_EQ(IPMI_CC_OK, CpldVersion(request.data(), reply, &dataLen, &hMock));
+ EXPECT_EQ(IPMI_CC_OK, cpldVersion(request.data(), reply, &dataLen, &hMock));
EXPECT_EQ(expectedMaj, reply[1]);
EXPECT_EQ(expectedMin, reply[2]);
EXPECT_EQ(expectedPt, reply[3]);
diff --git a/test/entity_unittest.cpp b/test/entity_unittest.cpp
index 74495c6..0a76d86 100644
--- a/test/entity_unittest.cpp
+++ b/test/entity_unittest.cpp
@@ -27,7 +27,7 @@
HandlerMock hMock;
EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
- GetEntityName(request.data(), reply, &dataLen, &hMock));
+ getEntityName(request.data(), reply, &dataLen, &hMock));
}
TEST(EntityNameCommandTest, ValidRequest)
@@ -44,7 +44,7 @@
EXPECT_CALL(hMock, getEntityName(entityId, entityInstance))
.WillOnce(Return(entityName));
EXPECT_EQ(IPMI_CC_OK,
- GetEntityName(request.data(), reply, &dataLen, &hMock));
+ getEntityName(request.data(), reply, &dataLen, &hMock));
EXPECT_EQ(reply[1], entityName.length());
EXPECT_EQ(0, std::memcmp(&reply[2], entityName.c_str(), reply[1]));
}
diff --git a/test/eth_unittest.cpp b/test/eth_unittest.cpp
index dd3c73f..af1a9cc 100644
--- a/test/eth_unittest.cpp
+++ b/test/eth_unittest.cpp
@@ -37,12 +37,12 @@
expectedAnswer + sizeof(expectedAnswer)))));
EXPECT_EQ(IPMI_CC_OK,
- GetEthDevice(request.data(), &reply[0], &dataLen, &hMock));
+ getEthDevice(request.data(), &reply[0], &dataLen, &hMock));
struct EthDeviceReply check;
std::memcpy(&check, &reply[0], sizeof(check));
EXPECT_EQ(check.subcommand, SysOEMCommands::SysGetEthDevice);
EXPECT_EQ(check.channel, expectedChannel);
- EXPECT_EQ(check.if_name_len, sizeof(expectedAnswer));
+ EXPECT_EQ(check.ifNameLength, sizeof(expectedAnswer));
EXPECT_EQ(0, std::memcmp(expectedAnswer, &reply[sizeof(check)],
sizeof(expectedAnswer)));
}
diff --git a/test/pcie_unittest.cpp b/test/pcie_unittest.cpp
index 34926ee..84bbe5c 100644
--- a/test/pcie_unittest.cpp
+++ b/test/pcie_unittest.cpp
@@ -29,7 +29,7 @@
EXPECT_CALL(hMock, buildI2cPcieMapping());
EXPECT_CALL(hMock, getI2cPcieMappingSize()).WillOnce(Return(expectedSize));
EXPECT_EQ(IPMI_CC_OK,
- PcieSlotCount(request.data(), reply, &dataLen, &hMock));
+ pcieSlotCount(request.data(), reply, &dataLen, &hMock));
EXPECT_EQ(expectedSize, reply[1]);
}
@@ -42,7 +42,7 @@
HandlerMock hMock;
EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
- PcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
+ pcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
}
TEST(PcieI2cCommandTest, PcieSlotEntryRequestUnsupportedByPlatform)
@@ -56,7 +56,7 @@
HandlerMock hMock;
EXPECT_CALL(hMock, getI2cPcieMappingSize()).WillOnce(Return(0));
EXPECT_EQ(IPMI_CC_INVALID_RESERVATION_ID,
- PcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
+ pcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
}
TEST(PcieI2cCommandTest, PcieSlotEntryRequestInvalidIndex)
@@ -70,7 +70,7 @@
HandlerMock hMock;
EXPECT_CALL(hMock, getI2cPcieMappingSize()).WillOnce(Return(1));
EXPECT_EQ(IPMI_CC_PARM_OUT_OF_RANGE,
- PcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
+ pcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
}
TEST(PcieI2cCommandTest, PcieSlotEntryRequestValidIndex)
@@ -89,7 +89,7 @@
EXPECT_CALL(hMock, getI2cEntry(index))
.WillOnce(Return(std::make_tuple(busNum, slotName)));
EXPECT_EQ(IPMI_CC_OK,
- PcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
+ pcieSlotI2cBusMapping(request.data(), reply, &dataLen, &hMock));
EXPECT_EQ(busNum, reply[1]);
EXPECT_EQ(slotName.length(), reply[2]);
EXPECT_EQ(0, std::memcmp(slotName.c_str(), &reply[3], reply[2]));
diff --git a/test/psu_unittest.cpp b/test/psu_unittest.cpp
index d2c84b1..7805370 100644
--- a/test/psu_unittest.cpp
+++ b/test/psu_unittest.cpp
@@ -25,7 +25,7 @@
HandlerMock hMock;
EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
- PsuHardReset(request.data(), reply, &dataLen, &hMock));
+ psuHardReset(request.data(), reply, &dataLen, &hMock));
}
TEST(PsuCommandTest, ValidRequest)
@@ -43,7 +43,7 @@
HandlerMock hMock;
EXPECT_CALL(hMock, psuResetDelay(delayValue));
EXPECT_EQ(IPMI_CC_OK,
- PsuHardReset(request.data(), reply, &dataLen, &hMock));
+ psuHardReset(request.data(), reply, &dataLen, &hMock));
}
} // namespace ipmi