Update to clang 10
Change code style to clang 10.
Change-Id: I42b0819bbeaf9dc68a99065d2df0e6ceb2eeedd0
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
diff --git a/include/commandutils.hpp b/include/commandutils.hpp
index c59a77f..17762a9 100644
--- a/include/commandutils.hpp
+++ b/include/commandutils.hpp
@@ -15,9 +15,10 @@
*/
#pragma once
-#include <iostream>
#include <sdbusplus/bus.hpp>
+#include <iostream>
+
static constexpr bool debug = false;
inline static void printRegistration(unsigned int netfn, unsigned int cmd)
diff --git a/include/oemcommands.hpp b/include/oemcommands.hpp
index 8599af4..7a6653b 100644
--- a/include/oemcommands.hpp
+++ b/include/oemcommands.hpp
@@ -138,17 +138,17 @@
#define BOOT_SEQ_ARRAY_SIZE 10
-const char *bootSeq[] = {"USB_DEV", "NET_IPV4", "SATA_HDD", "SATA_CD",
+const char* bootSeq[] = {"USB_DEV", "NET_IPV4", "SATA_HDD", "SATA_CD",
"OTHER", "", "", "",
"", "NET_IPV6"};
std::map<std::string, int> bootMap = {{"USB_DEV", 0}, {"NET_IPV4", 1},
{"NET_IPV6", 9}, {"SATA_HDD", 2},
{"SATA_CD", 3}, {"OTHER", 4}};
-const char *chassisType[] = {"ORV1", "ORV2"};
-const char *mbType[] = {"SS", "DS", "TYPE3"};
-const char *riserType[] = {"NO_CARD", "2_SLOT", "3_SLOT"};
-const char *pcieType[] = {"ABSENT", "AVA1", "AVA2", "AVA3",
+const char* chassisType[] = {"ORV1", "ORV2"};
+const char* mbType[] = {"SS", "DS", "TYPE3"};
+const char* riserType[] = {"NO_CARD", "2_SLOT", "3_SLOT"};
+const char* pcieType[] = {"ABSENT", "AVA1", "AVA2", "AVA3",
"AVA4", "Re-timer", "HBA", "OTHER"};
enum fb_ppr_sel
@@ -216,15 +216,15 @@
uint8_t data[];
} qDriveInfo_t;
-const char *cpuInfoKey[] = {"", "product_name", "basic_info",
+const char* cpuInfoKey[] = {"", "product_name", "basic_info",
"type", "micro_code", "turbo_mode"};
-const char *dimmInfoKey[] = {
+const char* dimmInfoKey[] = {
"", "location", "type", "speed", "part_name",
"serial_num", "manufacturer_id", "status", "present_bit"};
-const char *driveInfoKey[] = {"location", "serial_num", "model_name",
+const char* driveInfoKey[] = {"location", "serial_num", "model_name",
"fw_version", "capacity", "quantity",
"type", "wwn"};
-const char *ctrlTypeKey[] = {"bios", "expander", "lsi"};
+const char* ctrlTypeKey[] = {"bios", "expander", "lsi"};
diff --git a/include/sdrutils.hpp b/include/sdrutils.hpp
index 317ec06..138df11 100644
--- a/include/sdrutils.hpp
+++ b/include/sdrutils.hpp
@@ -1,10 +1,10 @@
#pragma once
-#include <ipmid/types.hpp>
-
#include <ipmid/api.h>
#include <stdint.h>
+#include <ipmid/types.hpp>
+
/**
* Get SDR
*/
diff --git a/include/sensorutils.hpp b/include/sensorutils.hpp
index 5b9fbb2..6af1d63 100644
--- a/include/sensorutils.hpp
+++ b/include/sensorutils.hpp
@@ -18,9 +18,10 @@
#pragma once
#include <ipmid/api.h>
+#include <phosphor-logging/log.hpp>
+
#include <cmath>
#include <iostream>
-#include <phosphor-logging/log.hpp>
namespace ipmi
{
@@ -63,9 +64,9 @@
boost::container::flat_map<std::string, std::vector<std::string>>,
CmpStrVersion>;
-inline static bool getSensorSubtree(SensorSubTree &subtree)
+inline static bool getSensorSubtree(SensorSubTree& subtree)
{
- sd_bus *bus = NULL;
+ sd_bus* bus = NULL;
int ret = sd_bus_default_system(&bus);
if (ret < 0)
{
@@ -81,7 +82,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree");
static constexpr const auto depth = 2;
- static constexpr std::array<const char *, 3> interfaces = {
+ static constexpr std::array<const char*, 3> interfaces = {
"xyz.openbmc_project.Sensor.Value",
"xyz.openbmc_project.Sensor.Threshold.Warning",
"xyz.openbmc_project.Sensor.Threshold.Critical"};
@@ -93,7 +94,7 @@
subtree.clear();
mapperReply.read(subtree);
}
- catch (sdbusplus::exception_t &e)
+ catch (sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return false;
@@ -104,20 +105,20 @@
// Specify the comparison required to sort and find char* map objects
struct CmpStr
{
- bool operator()(const char *a, const char *b) const
+ bool operator()(const char* a, const char* b) const
{
return std::strcmp(a, b) < 0;
}
};
-const static boost::container::flat_map<const char *, SensorUnits, CmpStr>
+const static boost::container::flat_map<const char*, SensorUnits, CmpStr>
sensorUnits{{{"temperature", SensorUnits::degreesC},
{"voltage", SensorUnits::volts},
{"current", SensorUnits::amps},
{"fan_tach", SensorUnits::rpm},
{"power", SensorUnits::watts}}};
-const static boost::container::flat_map<const char *, SensorTypeCodes, CmpStr>
+const static boost::container::flat_map<const char*, SensorTypeCodes, CmpStr>
sensorTypes{{{"temperature", SensorTypeCodes::temperature},
{"voltage", SensorTypeCodes::voltage},
{"current", SensorTypeCodes::current},
@@ -125,7 +126,7 @@
{"fan_pwm", SensorTypeCodes::fan},
{"power", SensorTypeCodes::other}}};
-inline static std::string getSensorTypeStringFromPath(const std::string &path)
+inline static std::string getSensorTypeStringFromPath(const std::string& path)
{
// get sensor type string from path, path is defined as
// /xyz/openbmc_project/sensors/<type>/label
@@ -144,7 +145,7 @@
return path.substr(typeStart, typeEnd - typeStart);
}
-inline static uint8_t getSensorTypeFromPath(const std::string &path)
+inline static uint8_t getSensorTypeFromPath(const std::string& path)
{
uint8_t sensorType = 0;
std::string type = getSensorTypeStringFromPath(path);
@@ -157,16 +158,16 @@
return sensorType;
}
-inline static uint8_t getSensorEventTypeFromPath(const std::string &path)
+inline static uint8_t getSensorEventTypeFromPath(const std::string& path)
{
// TODO: Add support for additional reading types as needed
return 0x1; // reading type = threshold
}
static inline bool getSensorAttributes(const double max, const double min,
- int16_t &mValue, int8_t &rExp,
- int16_t &bValue, int8_t &bExp,
- bool &bSigned)
+ int16_t& mValue, int8_t& rExp,
+ int16_t& bValue, int8_t& bExp,
+ bool& bSigned)
{
// computing y = (10^rRexp) * (Mx + (B*(10^Bexp)))
// check for 0, assume always positive
diff --git a/src/appcommands.cpp b/src/appcommands.cpp
index c50e840..52eceb3 100644
--- a/src/appcommands.cpp
+++ b/src/appcommands.cpp
@@ -15,20 +15,21 @@
* limitations under the License.
*/
-#include <ipmid/api.h>
-
-#include <sys/stat.h>
#include <fcntl.h>
+#include <ipmid/api.h>
+#include <sys/stat.h>
#include <unistd.h>
-#include <nlohmann/json.hpp>
+
+#include <appcommands.hpp>
#include <commandutils.hpp>
-#include <iostream>
-#include <iomanip>
-#include <sstream>
-#include <fstream>
+#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
-#include <appcommands.hpp>
+
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
namespace ipmi
{
@@ -38,14 +39,14 @@
// TODO Make offset and location runtime configurable to ensure we
// can make each define their own locations.
static constexpr off_t OFFSET_SYS_GUID = 0x17F0;
-static constexpr const char *FRU_EEPROM = "/sys/bus/i2c/devices/6-0054/eeprom";
+static constexpr const char* FRU_EEPROM = "/sys/bus/i2c/devices/6-0054/eeprom";
// TODO: Need to store this info after identifying proper storage
static uint8_t globEna = 0x09;
static SysInfoParam sysInfoParams;
nlohmann::json appData __attribute__((init_priority(101)));
-void printGUID(uint8_t *guid, off_t offset)
+void printGUID(uint8_t* guid, off_t offset)
{
std::cout << "Read GUID from offset : " << offset << " :\n";
for (int i = 0; i < GUID_SIZE; i++)
@@ -56,7 +57,7 @@
std::cout << std::endl;
}
-int getGUID(off_t offset, uint8_t *guid)
+int getGUID(off_t offset, uint8_t* guid)
{
int fd = -1;
ssize_t bytes_rd;
@@ -98,7 +99,7 @@
return ret;
}
-int getSystemGUID(uint8_t *guid)
+int getSystemGUID(uint8_t* guid)
{
return getGUID(OFFSET_SYS_GUID, guid);
}
@@ -110,7 +111,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
// TODO: Following data needs to be updated based on self-test results
*res++ = 0x55; // Self-Test result
@@ -128,7 +129,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
std::string mfrTest = "sled-cycle";
if (!memcmp(req, mfrTest.data(), mfrTest.length()) &&
@@ -156,7 +157,7 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
globEna = *req;
*data_len = 0;
@@ -173,7 +174,7 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
*data_len = 1;
*res++ = globEna;
@@ -203,7 +204,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
if (getSystemGUID(res))
{
return IPMI_CC_UNSPECIFIED_ERROR;
@@ -224,7 +225,7 @@
return;
}
-static int platSetSysFWVer(uint8_t *ver)
+static int platSetSysFWVer(uint8_t* ver)
{
std::stringstream ss;
int i;
@@ -248,7 +249,7 @@
return 0;
}
-static int platGetSysFWVer(uint8_t *ver)
+static int platGetSysFWVer(uint8_t* ver)
{
std::string str = appData[KEY_SYSFW_VER].get<std::string>();
int len;
@@ -272,7 +273,7 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
uint8_t param = req[0];
uint8_t req_len = *data_len;
@@ -346,8 +347,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t param = req[1];
uint8_t len;
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 338cb17..ca0dc0e 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -16,20 +16,21 @@
*/
#include "xyz/openbmc_project/Common/error.hpp"
-#include <ipmid/api.hpp>
-#include <nlohmann/json.hpp>
-#include <array>
-#include <commandutils.hpp>
-#include <cstring>
-#include <iostream>
-#include <iomanip>
-#include <sstream>
-#include <fstream>
-#include <oemcommands.hpp>
+#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
+#include <commandutils.hpp>
+#include <nlohmann/json.hpp>
+#include <oemcommands.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+
+#include <array>
+#include <cstring>
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
#include <string>
#include <vector>
@@ -44,15 +45,15 @@
sdbusplus::bus::bus dbus(ipmid_get_sd_bus_connection()); // from ipmid/api.h
static constexpr size_t maxFRUStringLength = 0x3F;
-int plat_udbg_get_post_desc(uint8_t, uint8_t *, uint8_t, uint8_t *, uint8_t *,
- uint8_t *);
-int plat_udbg_get_gpio_desc(uint8_t, uint8_t *, uint8_t *, uint8_t *, uint8_t *,
- uint8_t *);
-ipmi_ret_t plat_udbg_get_frame_data(uint8_t, uint8_t, uint8_t *, uint8_t *,
- uint8_t *);
-ipmi_ret_t plat_udbg_control_panel(uint8_t, uint8_t, uint8_t, uint8_t *,
- uint8_t *);
-int sendMeCmd(uint8_t, uint8_t, std::vector<uint8_t> &, std::vector<uint8_t> &);
+int plat_udbg_get_post_desc(uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t*,
+ uint8_t*);
+int plat_udbg_get_gpio_desc(uint8_t, uint8_t*, uint8_t*, uint8_t*, uint8_t*,
+ uint8_t*);
+ipmi_ret_t plat_udbg_get_frame_data(uint8_t, uint8_t, uint8_t*, uint8_t*,
+ uint8_t*);
+ipmi_ret_t plat_udbg_control_panel(uint8_t, uint8_t, uint8_t, uint8_t*,
+ uint8_t*);
+int sendMeCmd(uint8_t, uint8_t, std::vector<uint8_t>&, std::vector<uint8_t>&);
nlohmann::json oemData __attribute__((init_priority(101)));
@@ -84,15 +85,15 @@
constexpr auto IP_INTERFACE = "xyz.openbmc_project.Network.IP";
constexpr auto MAC_INTERFACE = "xyz.openbmc_project.Network.MACAddress";
-bool isLinkLocalIP(const std::string &address)
+bool isLinkLocalIP(const std::string& address)
{
return address.find(IPV4_PREFIX) == 0 || address.find(IPV6_PREFIX) == 0;
}
-DbusObjectInfo getIPObject(sdbusplus::bus::bus &bus,
- const std::string &interface,
- const std::string &serviceRoot,
- const std::string &match)
+DbusObjectInfo getIPObject(sdbusplus::bus::bus& bus,
+ const std::string& interface,
+ const std::string& serviceRoot,
+ const std::string& match)
{
auto objectTree = getAllDbusObjects(bus, serviceRoot, interface, match);
@@ -104,7 +105,7 @@
DbusObjectInfo objectInfo;
- for (auto &object : objectTree)
+ for (auto& object : objectTree)
{
auto variant =
ipmi::getDbusProperty(bus, object.second.begin()->first,
@@ -139,7 +140,7 @@
return;
}
-std::string bytesToStr(uint8_t *byte, int len)
+std::string bytesToStr(uint8_t* byte, int len)
{
std::stringstream ss;
int i;
@@ -153,7 +154,7 @@
return ss.str();
}
-int strToBytes(std::string &str, uint8_t *data)
+int strToBytes(std::string& str, uint8_t* data)
{
std::string sstr;
int i;
@@ -166,7 +167,7 @@
return i;
}
-ipmi_ret_t getNetworkData(uint8_t lan_param, char *data)
+ipmi_ret_t getNetworkData(uint8_t lan_param, char* data)
{
ipmi_ret_t rc = IPMI_CC_OK;
sdbusplus::bus::bus bus(ipmid_get_sd_bus_connection());
@@ -175,8 +176,7 @@
switch (static_cast<LanParam>(lan_param))
{
- case LanParam::IP:
- {
+ case LanParam::IP: {
auto ethIP = ethdevice + "/" + ipmi::network::IPV4_TYPE;
std::string ipaddress;
auto ipObjectInfo = ipmi::network::getIPObject(
@@ -192,8 +192,7 @@
}
break;
- case LanParam::IPV6:
- {
+ case LanParam::IPV6: {
auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE;
std::string ipaddress;
auto ipObjectInfo = ipmi::network::getIPObject(
@@ -209,8 +208,7 @@
}
break;
- case LanParam::MAC:
- {
+ case LanParam::MAC: {
std::string macAddress;
auto macObjectInfo =
ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE,
@@ -236,7 +234,7 @@
}
// return code: 0 successful
-int8_t getFruData(std::string &data, std::string &name)
+int8_t getFruData(std::string& data, std::string& name)
{
std::string objpath = "/xyz/openbmc_project/FruDevice";
std::string intf = "xyz.openbmc_project.FruDeviceManager";
@@ -250,7 +248,7 @@
return -1;
}
- for (const auto &item : valueTree)
+ for (const auto& item : valueTree)
{
auto interface = item.second.find("xyz.openbmc_project.FruDevice");
if (interface == item.second.end())
@@ -267,7 +265,7 @@
try
{
Value variant = property->second;
- std::string &result = std::get<std::string>(variant);
+ std::string& result = std::get<std::string>(variant);
if (result.size() > maxFRUStringLength)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -277,7 +275,7 @@
data = result;
return 0;
}
- catch (std::bad_variant_access &e)
+ catch (std::bad_variant_access& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
@@ -303,8 +301,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t num_frames = 3;
std::memcpy(res, req, SIZE_IANA_ID); // IANA ID
@@ -323,8 +321,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t num_updates = 3;
*data_len = 4;
@@ -347,8 +345,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t index = 0;
uint8_t next = 0;
uint8_t end = 0;
@@ -387,8 +385,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t index = 0;
uint8_t next = 0;
@@ -428,8 +426,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t frame;
uint8_t page;
uint8_t next;
@@ -468,8 +466,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t panel;
uint8_t operation;
@@ -496,7 +494,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
uint8_t index = req[0];
uint8_t type = req[1];
@@ -529,8 +527,8 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
/* TODO: Needs to implement this after GPIO implementation */
*data_len = 0;
@@ -539,7 +537,7 @@
}
/* Helper functions to set boot order */
-void setBootOrder(uint8_t *data)
+void setBootOrder(uint8_t* data)
{
nlohmann::json bootMode;
uint8_t mode = data[0];
@@ -571,7 +569,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
uint8_t len = *data_len;
*data_len = 0;
@@ -595,7 +593,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t mode = 0;
int i;
@@ -647,7 +645,7 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- machineConfigInfo_t *req = reinterpret_cast<machineConfigInfo_t *>(request);
+ machineConfigInfo_t* req = reinterpret_cast<machineConfigInfo_t*>(request);
uint8_t len = *data_len;
*data_len = 0;
@@ -659,13 +657,13 @@
return IPMI_CC_REQ_DATA_LEN_INVALID;
}
- if (req->chassis_type >= sizeof(chassisType) / sizeof(uint8_t *))
+ if (req->chassis_type >= sizeof(chassisType) / sizeof(uint8_t*))
oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] = "UNKNOWN";
else
oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] =
chassisType[req->chassis_type];
- if (req->mb_type >= sizeof(mbType) / sizeof(uint8_t *))
+ if (req->mb_type >= sizeof(mbType) / sizeof(uint8_t*))
oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = "UNKNOWN";
else
oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = mbType[req->mb_type];
@@ -675,7 +673,7 @@
oemData[KEY_MC_CONFIG][KEY_MC_HDD35_CNT] = req->hdd35_cnt;
oemData[KEY_MC_CONFIG][KEY_MC_HDD25_CNT] = req->hdd25_cnt;
- if (req->riser_type >= sizeof(riserType) / sizeof(uint8_t *))
+ if (req->riser_type >= sizeof(riserType) / sizeof(uint8_t*))
oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = "UNKNOWN";
else
oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = riserType[req->riser_type];
@@ -691,25 +689,25 @@
if (req->pcie_card_loc & BIT_3)
oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT4";
- if (req->slot1_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
+ if (req->slot1_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*))
oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] = "UNKNOWN";
else
oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] =
pcieType[req->slot1_pcie_type];
- if (req->slot2_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
+ if (req->slot2_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*))
oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] = "UNKNOWN";
else
oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] =
pcieType[req->slot2_pcie_type];
- if (req->slot3_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
+ if (req->slot3_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*))
oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] = "UNKNOWN";
else
oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] =
pcieType[req->slot3_pcie_type];
- if (req->slot4_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
+ if (req->slot4_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*))
oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] = "UNKNOWN";
else
oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] =
@@ -776,7 +774,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
std::string ppinStr;
int len;
@@ -828,7 +826,7 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
uint8_t pprCnt, pprAct, pprIndex;
uint8_t selParam = req[0];
uint8_t len = *data_len;
@@ -918,8 +916,8 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t pprCnt, pprIndex;
uint8_t selParam = req[0];
std::stringstream ss;
@@ -1030,8 +1028,8 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- qProcInfo_t *req = reinterpret_cast<qProcInfo_t *>(request);
- uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t *);
+ qProcInfo_t* req = reinterpret_cast<qProcInfo_t*>(request);
+ uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t*);
std::stringstream ss;
std::string str;
uint8_t len = *data_len;
@@ -1088,9 +1086,9 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- qProcInfo_t *req = reinterpret_cast<qProcInfo_t *>(request);
- uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t *);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ qProcInfo_t* req = reinterpret_cast<qProcInfo_t*>(request);
+ uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t*);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
std::stringstream ss;
std::string str;
@@ -1182,8 +1180,8 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- qDimmInfo_t *req = reinterpret_cast<qDimmInfo_t *>(request);
- uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t *);
+ qDimmInfo_t* req = reinterpret_cast<qDimmInfo_t*>(request);
+ uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t*);
std::stringstream ss;
std::string str;
uint8_t len = *data_len;
@@ -1275,9 +1273,9 @@
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- qDimmInfo_t *req = reinterpret_cast<qDimmInfo_t *>(request);
- uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t *);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ qDimmInfo_t* req = reinterpret_cast<qDimmInfo_t*>(request);
+ uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t*);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
std::stringstream ss;
std::string str;
@@ -1389,8 +1387,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- qDriveInfo_t *req = reinterpret_cast<qDriveInfo_t *>(request);
- uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t *);
+ qDriveInfo_t* req = reinterpret_cast<qDriveInfo_t*>(request);
+ uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t*);
uint8_t ctrlType = req->hddCtrlType & 0x0f;
std::stringstream ss;
std::string str;
@@ -1451,9 +1449,9 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- qDriveInfo_t *req = reinterpret_cast<qDriveInfo_t *>(request);
- uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t *);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ qDriveInfo_t* req = reinterpret_cast<qDriveInfo_t*>(request);
+ uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t*);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t ctrlType = req->hddCtrlType & 0x0f;
std::stringstream ss;
std::string str;
@@ -1493,7 +1491,7 @@
/* Helper function for sending DCMI commands to ME and getting response back */
ipmi::RspType<std::vector<uint8_t>> sendDCMICmd(uint8_t cmd,
- std::vector<uint8_t> &cmdData)
+ std::vector<uint8_t>& cmdData)
{
std::vector<uint8_t> respData;
diff --git a/src/selcommands.cpp b/src/selcommands.cpp
index 5cd818e..e305c44 100644
--- a/src/selcommands.cpp
+++ b/src/selcommands.cpp
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-#include <ipmid/api.hpp>
-
#include <boost/algorithm/string/join.hpp>
+#include <ipmid/api.hpp>
#include <nlohmann/json.hpp>
-#include <iostream>
-#include <sstream>
-#include <fstream>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
#include <sdbusplus/timer.hpp>
#include <storagecommands.hpp>
+#include <fstream>
+#include <iostream>
+#include <sstream>
+
//----------------------------------------------------------------------
// Platform specific functions for storing app data
//----------------------------------------------------------------------
@@ -41,7 +41,7 @@
return ss.str();
}
-static void toHexStr(std::vector<uint8_t> &bytes, std::string &hexStr)
+static void toHexStr(std::vector<uint8_t>& bytes, std::string& hexStr)
{
std::stringstream stream;
stream << std::hex << std::uppercase << std::setfill('0');
@@ -52,7 +52,7 @@
hexStr = stream.str();
}
-static int fromHexStr(const std::string hexStr, std::vector<uint8_t> &data)
+static int fromHexStr(const std::string hexStr, std::vector<uint8_t>& data)
{
for (unsigned int i = 0; i < hexStr.size(); i += 2)
{
@@ -61,12 +61,12 @@
data.push_back(static_cast<uint8_t>(
std::stoul(hexStr.substr(i, 2), nullptr, 16)));
}
- catch (std::invalid_argument &e)
+ catch (std::invalid_argument& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
}
- catch (std::out_of_range &e)
+ catch (std::out_of_range& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
@@ -141,7 +141,7 @@
return selDataObj[KEY_SEL_COUNT];
}
- void getInfo(GetSELInfoData &info)
+ void getInfo(GetSELInfoData& info)
{
info.selVersion = selDataObj[KEY_SEL_VER];
info.entries = selDataObj[KEY_SEL_COUNT];
@@ -151,7 +151,7 @@
info.operationSupport = selDataObj[KEY_OPER_SUPP];
}
- int getEntry(uint32_t index, std::string &rawStr)
+ int getEntry(uint32_t index, std::string& rawStr)
{
std::stringstream ss;
ss << std::hex;
@@ -206,12 +206,12 @@
"High Power I/O subsystem", "Unknown"};
/* Default log message for unknown type */
-static void logDefault(uint8_t *data, std::string &errLog)
+static void logDefault(uint8_t* data, std::string& errLog)
{
errLog = "Unknown";
}
-static void logSysEvent(uint8_t *data, std::string &errLog)
+static void logSysEvent(uint8_t* data, std::string& errLog)
{
if (data[0] == 0xE5)
{
@@ -245,7 +245,7 @@
}
}
-static void logThermalEvent(uint8_t *data, std::string &errLog)
+static void logThermalEvent(uint8_t* data, std::string& errLog)
{
if (data[0] == 0x1)
{
@@ -257,7 +257,7 @@
}
}
-static void logCritIrq(uint8_t *data, std::string &errLog)
+static void logCritIrq(uint8_t* data, std::string& errLog)
{
if (data[0] == 0x0)
@@ -276,7 +276,7 @@
/* TODO: Call add_cri_sel for CRITICAL_IRQ */
}
-static void logPostErr(uint8_t *data, std::string &errLog)
+static void logPostErr(uint8_t* data, std::string& errLog)
{
if ((data[0] & 0x0F) == 0x0)
@@ -315,7 +315,7 @@
}
}
-static void logMchChkErr(uint8_t *data, std::string &errLog)
+static void logMchChkErr(uint8_t* data, std::string& errLog)
{
/* TODO: Call add_cri_sel for CRITICAL_IRQ */
if ((data[0] & 0x0F) == 0x0B)
@@ -336,7 +336,7 @@
std::to_string(data[2] & 0x1F);
}
-static void logPcieErr(uint8_t *data, std::string &errLog)
+static void logPcieErr(uint8_t* data, std::string& errLog)
{
std::stringstream tmp1, tmp2;
tmp1 << std::hex << std::uppercase << std::setfill('0');
@@ -362,15 +362,13 @@
case 0xA:
errLog = "Bus Fatal" + tmp1.str();
break;
- case 0xD:
- {
+ case 0xD: {
uint32_t venId = (uint32_t)data[1] << 8 | (uint32_t)data[2];
tmp2 << "Vendor ID: 0x" << std::setw(4) << venId;
errLog = tmp2.str();
}
break;
- case 0xE:
- {
+ case 0xE: {
uint32_t devId = (uint32_t)data[1] << 8 | (uint32_t)data[2];
tmp2 << "Device ID: 0x" << std::setw(4) << devId;
errLog = tmp2.str();
@@ -386,7 +384,7 @@
}
}
-static void logIioErr(uint8_t *data, std::string &errLog)
+static void logIioErr(uint8_t* data, std::string& errLog)
{
std::vector<std::string> tmpStr = {
"IRP0", "IRP1", " IIO-Core", "VT-d", "Intel Quick Data",
@@ -412,11 +410,11 @@
}
}
-static void logMemErr(uint8_t *dataPtr, std::string &errLog)
+static void logMemErr(uint8_t* dataPtr, std::string& errLog)
{
uint8_t snrType = dataPtr[0];
uint8_t snrNum = dataPtr[1];
- uint8_t *data = &(dataPtr[3]);
+ uint8_t* data = &(dataPtr[3]);
/* TODO: add pal_add_cri_sel */
@@ -481,8 +479,7 @@
switch ((data[1] & 0xC) >> 2)
{
- case 0x0:
- {
+ case 0x0: {
/* All Info Valid */
uint8_t chnNum = (data[2] & 0x1C) >> 2;
@@ -528,7 +525,7 @@
}
}
-static void logPwrErr(uint8_t *data, std::string &errLog)
+static void logPwrErr(uint8_t* data, std::string& errLog)
{
if (data[0] == 0x1)
@@ -549,7 +546,7 @@
}
}
-static void logCatErr(uint8_t *data, std::string &errLog)
+static void logCatErr(uint8_t* data, std::string& errLog)
{
if (data[0] == 0x0)
@@ -570,7 +567,7 @@
}
}
-static void logDimmHot(uint8_t *data, std::string &errLog)
+static void logDimmHot(uint8_t* data, std::string& errLog)
{
if ((data[0] << 16 | data[1] << 8 | data[2]) == 0x01FFFF)
{
@@ -584,7 +581,7 @@
}
}
-static void logSwNMI(uint8_t *data, std::string &errLog)
+static void logSwNMI(uint8_t* data, std::string& errLog)
{
if ((data[0] << 16 | data[1] << 8 | data[2]) == 0x03FFFF)
{
@@ -596,7 +593,7 @@
}
}
-static void logCPUThermalSts(uint8_t *data, std::string &errLog)
+static void logCPUThermalSts(uint8_t* data, std::string& errLog)
{
switch (data[0])
{
@@ -614,7 +611,7 @@
}
}
-static void logMEPwrState(uint8_t *data, std::string &errLog)
+static void logMEPwrState(uint8_t* data, std::string& errLog)
{
switch (data[0])
{
@@ -630,7 +627,7 @@
}
}
-static void logSPSFwHealth(uint8_t *data, std::string &errLog)
+static void logSPSFwHealth(uint8_t* data, std::string& errLog)
{
if ((data[0] & 0x0F) == 0x00)
{
@@ -675,7 +672,7 @@
}
}
-static void logNmExcA(uint8_t *data, std::string &errLog)
+static void logNmExcA(uint8_t* data, std::string& errLog)
{
/*NM4.0 #550710, Revision 1.95, and turn to p.155*/
if (data[0] == 0xA8)
@@ -688,7 +685,7 @@
}
}
-static void logPCHThermal(uint8_t *data, std::string &errLog)
+static void logPCHThermal(uint8_t* data, std::string& errLog)
{
const std::vector<std::string> thresEvtName = {"Lower Non-critical",
"Unknown",
@@ -716,7 +713,7 @@
" C, thresh_val: " + std::to_string(data[2]) + " C";
}
-static void logNmHealth(uint8_t *data, std::string &errLog)
+static void logNmHealth(uint8_t* data, std::string& errLog)
{
std::vector<std::string> nmErrType = {
"Unknown",
@@ -754,7 +751,7 @@
byteToStr(data[2]);
}
-static void logNmCap(uint8_t *data, std::string &errLog)
+static void logNmCap(uint8_t* data, std::string& errLog)
{
const std::vector<std::string> nmCapStsStr = {"Not Available", "Available"};
@@ -771,7 +768,7 @@
}
}
-static void logNmThreshold(uint8_t *data, std::string &errLog)
+static void logNmThreshold(uint8_t* data, std::string& errLog)
{
uint8_t thresNum = (data[0] & 0x3);
uint8_t domIdx = (data[1] & 0xf);
@@ -785,7 +782,7 @@
", PolicyID:0x" + byteToStr(polId);
}
-static void logPwrThreshold(uint8_t *data, std::string &errLog)
+static void logPwrThreshold(uint8_t* data, std::string& errLog)
{
if (data[0] == 0x00)
{
@@ -801,7 +798,7 @@
}
}
-static void logMSMI(uint8_t *data, std::string &errLog)
+static void logMSMI(uint8_t* data, std::string& errLog)
{
if (data[0] == 0x0)
@@ -818,7 +815,7 @@
}
}
-static void logHprWarn(uint8_t *data, std::string &errLog)
+static void logHprWarn(uint8_t* data, std::string& errLog)
{
if (data[2] == 0x01)
{
@@ -839,7 +836,7 @@
static const boost::container::flat_map<
uint8_t,
- std::pair<std::string, std::function<void(uint8_t *, std::string &)>>>
+ std::pair<std::string, std::function<void(uint8_t*, std::string&)>>>
sensorNameTable = {{0xE9, {"SYSTEM_EVENT", logSysEvent}},
{0x7D, {"THERM_THRESH_EVT", logThermalEvent}},
{0xAA, {"BUTTON", logDefault}},
@@ -870,7 +867,7 @@
{0xE7, {"MSMI", logMSMI}},
{0xC5, {"HPR_WARNING", logHprWarn}}};
-static void parseSelHelper(StdSELEntry *data, std::string &errStr)
+static void parseSelHelper(StdSELEntry* data, std::string& errStr)
{
/* Check if sensor type is OS_BOOT (0x1f) */
@@ -928,7 +925,7 @@
}
}
-static void parseStdSel(StdSELEntry *data, std::string &errStr)
+static void parseStdSel(StdSELEntry* data, std::string& errStr)
{
std::stringstream tmpStream;
tmpStream << std::hex << std::uppercase;
@@ -1007,7 +1004,7 @@
return;
}
-static void parseOemSel(TsOemSELEntry *data, std::string &errStr)
+static void parseOemSel(TsOemSELEntry* data, std::string& errStr)
{
std::stringstream tmpStream;
tmpStream << std::hex << std::uppercase << std::setfill('0');
@@ -1048,9 +1045,9 @@
return;
}
-static void parseOemUnifiedSel(NtsOemSELEntry *data, std::string &errStr)
+static void parseOemUnifiedSel(NtsOemSELEntry* data, std::string& errStr)
{
- uint8_t *ptr = data->oemData;
+ uint8_t* ptr = data->oemData;
int genInfo = ptr[0];
int errType = genInfo & 0x0f;
std::vector<std::string> dimmEvent = {
@@ -1103,14 +1100,14 @@
return;
}
-static void parseSelData(std::vector<uint8_t> &reqData, std::string &msgLog)
+static void parseSelData(std::vector<uint8_t>& reqData, std::string& msgLog)
{
/* Get record type */
int recType = reqData[2];
std::string errType, errLog;
- uint8_t *ptr = NULL;
+ uint8_t* ptr = NULL;
std::stringstream recTypeStream;
recTypeStream << std::hex << std::uppercase << std::setfill('0')
@@ -1120,7 +1117,7 @@
if (recType == stdErrType)
{
- StdSELEntry *data = reinterpret_cast<StdSELEntry *>(&reqData[0]);
+ StdSELEntry* data = reinterpret_cast<StdSELEntry*>(&reqData[0]);
std::string sensorName;
errType = stdErr;
@@ -1141,7 +1138,7 @@
}
}
- std::tm *ts = localtime((time_t *)(&(data->timeStamp)));
+ std::tm* ts = localtime((time_t*)(&(data->timeStamp)));
std::string timeStr = std::asctime(ts);
parseStdSel(data, errLog);
@@ -1162,7 +1159,7 @@
else if ((recType >= oemTSErrTypeMin) && (recType <= oemTSErrTypeMax))
{
/* timestamped OEM SEL records */
- TsOemSELEntry *data = reinterpret_cast<TsOemSELEntry *>(&reqData[0]);
+ TsOemSELEntry* data = reinterpret_cast<TsOemSELEntry*>(&reqData[0]);
ptr = data->mfrId;
std::vector<uint8_t> mfrIdData(ptr, ptr + 3);
std::string mfrIdStr;
@@ -1173,7 +1170,7 @@
std::string oemDataStr;
toHexStr(oemData, oemDataStr);
- std::tm *ts = localtime((time_t *)(&(data->timeStamp)));
+ std::tm* ts = localtime((time_t*)(&(data->timeStamp)));
std::string timeStr = std::asctime(ts);
errType = oemTSErr;
@@ -1185,7 +1182,7 @@
}
else if (recType == fbUniErrType)
{
- NtsOemSELEntry *data = reinterpret_cast<NtsOemSELEntry *>(&reqData[0]);
+ NtsOemSELEntry* data = reinterpret_cast<NtsOemSELEntry*>(&reqData[0]);
errType = fbUniSELErr;
parseOemUnifiedSel(data, errLog);
msgLog += errType + " (0x" + recTypeStream.str() + "), " + errLog;
@@ -1193,7 +1190,7 @@
else if ((recType >= oemNTSErrTypeMin) && (recType <= oemNTSErrTypeMax))
{
/* Non timestamped OEM SEL records */
- NtsOemSELEntry *data = reinterpret_cast<NtsOemSELEntry *>(&reqData[0]);
+ NtsOemSELEntry* data = reinterpret_cast<NtsOemSELEntry*>(&reqData[0]);
errType = oemNTSErr;
ptr = data->oemData;
@@ -1201,7 +1198,7 @@
std::string oemDataStr;
toHexStr(oemData, oemDataStr);
- parseOemSel((TsOemSELEntry *)data, errLog);
+ parseOemSel((TsOemSELEntry*)data, errLog);
msgLog += errType + " (0x" + recTypeStream.str() + "), OEM Data: (" +
oemDataStr + ") " + errLog;
}
@@ -1251,8 +1248,8 @@
return ipmi::responseReqDataLenInvalid();
}
- fb_oem::ipmi::sel::GetSELEntryRequest *reqData =
- reinterpret_cast<fb_oem::ipmi::sel::GetSELEntryRequest *>(&data[0]);
+ fb_oem::ipmi::sel::GetSELEntryRequest* reqData =
+ reinterpret_cast<fb_oem::ipmi::sel::GetSELEntryRequest*>(&data[0]);
if (reqData->reservID != 0)
{
@@ -1370,7 +1367,7 @@
}
ipmi::RspType<uint8_t> ipmiStorageClearSEL(uint16_t reservationID,
- const std::array<uint8_t, 3> &clr,
+ const std::array<uint8_t, 3>& clr,
uint8_t eraseOperation)
{
if (!checkSELReservation(reservationID))
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 4dd6b72..787690a 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -19,7 +19,6 @@
#include <boost/container/flat_map.hpp>
#include <commandutils.hpp>
-#include <iostream>
#include <ipmid/utils.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/message/types.hpp>
@@ -27,6 +26,8 @@
#include <sensorutils.hpp>
#include <storagecommands.hpp>
+#include <iostream>
+
namespace ipmi
{
@@ -58,7 +59,7 @@
boost::container::flat_map<
std::string, boost::container::flat_map<std::string, DbusVariant>>>;
-constexpr static const char *fruDeviceServiceName =
+constexpr static const char* fruDeviceServiceName =
"xyz.openbmc_project.FruDevice";
constexpr static const size_t cacheTimeoutSeconds = 10;
@@ -75,7 +76,7 @@
static sdbusplus::bus::bus dbus(ipmid_get_sd_bus_connection());
static bool getSensorMap(std::string sensorConnection, std::string sensorPath,
- SensorMap &sensorMap)
+ SensorMap& sensorMap)
{
static boost::container::flat_map<
std::string, std::chrono::time_point<std::chrono::steady_clock>>
@@ -105,7 +106,7 @@
auto reply = dbus.call(managedObj);
reply.read(managedObjects);
}
- catch (sdbusplus::exception_t &)
+ catch (sdbusplus::exception_t&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error getting managed objects from connection",
@@ -141,7 +142,7 @@
{
sdbusplus::message::message writeFruResp = dbus.call(writeFru);
}
- catch (sdbusplus::exception_t &)
+ catch (sdbusplus::exception_t&)
{
// todo: log sel?
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -184,7 +185,7 @@
sdbusplus::message::message resp = dbus.call(getObjects);
resp.read(frus);
}
- catch (sdbusplus::exception_t &)
+ catch (sdbusplus::exception_t&)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"replaceCacheFru: error getting managed objects");
@@ -196,7 +197,7 @@
// hash the object paths to create unique device id's. increment on
// collision
std::hash<std::string> hasher;
- for (const auto &fru : frus)
+ for (const auto& fru : frus)
{
auto fruIface = fru.second.find("xyz.openbmc_project.FruDevice");
if (fruIface == fru.second.end())
@@ -268,7 +269,7 @@
sdbusplus::message::message getRawResp = dbus.call(getRawFru);
getRawResp.read(fruCache);
}
- catch (sdbusplus::exception_t &)
+ catch (sdbusplus::exception_t&)
{
lastDevId = 0xFF;
cacheBus = 0xFF;
@@ -293,7 +294,7 @@
}
*dataLen = 0; // default to 0 in case of an error
- auto req = static_cast<GetFRUAreaReq *>(request);
+ auto req = static_cast<GetFRUAreaReq*>(request);
if (req->countToRead > maxMessageSize - 1)
{
@@ -316,7 +317,7 @@
fromFRUByteLen = fruCache.size() - req->fruInventoryOffset;
}
size_t padByteLen = req->countToRead - fromFRUByteLen;
- uint8_t *respPtr = static_cast<uint8_t *>(response);
+ uint8_t* respPtr = static_cast<uint8_t*>(response);
*respPtr = req->countToRead;
std::copy(fruCache.begin() + req->fruInventoryOffset,
fruCache.begin() + req->fruInventoryOffset + fromFRUByteLen,
@@ -347,7 +348,7 @@
return IPMI_CC_REQ_DATA_LEN_INVALID;
}
- auto req = static_cast<WriteFRUDataReq *>(request);
+ auto req = static_cast<WriteFRUDataReq*>(request);
size_t writeLen = *dataLen - 3;
*dataLen = 0; // default to 0 in case of an error
@@ -370,7 +371,7 @@
if (fruCache.size() >= sizeof(FRUHeader))
{
- FRUHeader *header = reinterpret_cast<FRUHeader *>(fruCache.data());
+ FRUHeader* header = reinterpret_cast<FRUHeader*>(fruCache.data());
int lastRecordStart = std::max(
header->internalOffset,
@@ -393,7 +394,7 @@
}
}
}
- uint8_t *respPtr = static_cast<uint8_t *>(response);
+ uint8_t* respPtr = static_cast<uint8_t*>(response);
if (atEnd)
{
// cancel timer, we're at the end so might as well send it
@@ -419,7 +420,7 @@
return IPMI_CC_OK;
}
-ipmi_ret_t getFruSdrCount(size_t &count)
+ipmi_ret_t getFruSdrCount(size_t& count)
{
ipmi_ret_t ret = replaceCacheFru(0);
if (ret != IPMI_CC_OK)
@@ -430,7 +431,7 @@
return IPMI_CC_OK;
}
-ipmi_ret_t getFruSdrs(size_t index, get_sdr::SensorDataFruRecord &resp)
+ipmi_ret_t getFruSdrs(size_t index, get_sdr::SensorDataFruRecord& resp)
{
ipmi_ret_t ret = replaceCacheFru(0); // this will update the hash list
if (ret != IPMI_CC_OK)
@@ -442,8 +443,8 @@
return IPMI_CC_INVALID_FIELD_REQUEST;
}
auto device = deviceHashes.begin() + index;
- uint8_t &bus = device->second.first;
- uint8_t &address = device->second.second;
+ uint8_t& bus = device->second.first;
+ uint8_t& address = device->second.second;
ManagedObjectType frus;
@@ -455,14 +456,14 @@
sdbusplus::message::message resp = dbus.call(getObjects);
resp.read(frus);
}
- catch (sdbusplus::exception_t &)
+ catch (sdbusplus::exception_t&)
{
return IPMI_CC_RESPONSE_ERROR;
}
- boost::container::flat_map<std::string, DbusVariant> *fruData = nullptr;
+ boost::container::flat_map<std::string, DbusVariant>* fruData = nullptr;
auto fru =
std::find_if(frus.begin(), frus.end(),
- [bus, address, &fruData](ManagedEntry &entry) {
+ [bus, address, &fruData](ManagedEntry& entry) {
auto findFruDevice =
entry.second.find("xyz.openbmc_project.FruDevice");
if (findFruDevice == entry.second.end())
@@ -553,7 +554,7 @@
sdrReservationID++;
}
*dataLen = 2;
- auto resp = static_cast<uint8_t *>(response);
+ auto resp = static_cast<uint8_t*>(response);
resp[0] = sdrReservationID & 0xFF;
resp[1] = sdrReservationID >> 8;
@@ -575,7 +576,7 @@
*dataLen = 0; // default to 0 in case of an error
constexpr uint16_t lastRecordIndex = 0xFFFF;
- auto req = static_cast<GetSDRReq *>(request);
+ auto req = static_cast<GetSDRReq*>(request);
// reservation required for partial reads with non zero offset into
// record
@@ -610,10 +611,10 @@
uint16_t nextRecord =
lastRecord > (req->recordID + 1) ? req->recordID + 1 : 0XFFFF;
- auto responseClear = static_cast<uint8_t *>(response);
+ auto responseClear = static_cast<uint8_t*>(response);
std::fill(responseClear, responseClear + requestedSize, 0);
- auto resp = static_cast<get_sdr::GetSdrResp *>(response);
+ auto resp = static_cast<get_sdr::GetSdrResp*>(response);
resp->next_record_id_lsb = nextRecord & 0xFF;
resp->next_record_id_msb = nextRecord >> 8;
@@ -641,7 +642,7 @@
req->bytesToRead = sizeof(data) - req->offset;
}
*dataLen = req->bytesToRead + 2; // next record
- std::memcpy(&resp->record_data, (char *)&data + req->offset,
+ std::memcpy(&resp->record_data, (char*)&data + req->offset,
req->bytesToRead);
return IPMI_CC_OK;
}
@@ -649,7 +650,7 @@
std::string connection;
std::string path;
uint16_t sensorIndex = req->recordID;
- for (const auto &sensor : sensorTree)
+ for (const auto& sensor : sensorTree)
{
if (sensorIndex-- == 0)
{
@@ -797,21 +798,21 @@
*dataLen =
2 + req->bytesToRead; // bytesToRead + MSB and LSB of next record id
- std::memcpy(&resp->record_data, (char *)&record + req->offset,
+ std::memcpy(&resp->record_data, (char*)&record + req->offset,
req->bytesToRead);
return IPMI_CC_OK;
}
-static int getSensorConnectionByName(std::string &name, std::string &connection,
- std::string &path)
+static int getSensorConnectionByName(std::string& name, std::string& connection,
+ std::string& path)
{
if (sensorTree.empty() && !getSensorSubtree(sensorTree))
{
return -1;
}
- for (const auto &sensor : sensorTree)
+ for (const auto& sensor : sensorTree)
{
path = sensor.first;
if (path.find(name) != std::string::npos)
@@ -823,7 +824,7 @@
return -1;
}
-int getSensorValue(std::string &name, double &val)
+int getSensorValue(std::string& name, double& val)
{
std::string connection;
std::string path;
@@ -847,13 +848,13 @@
{
return ret;
}
- auto &valueVariant = sensorObject->second["Value"];
+ auto& valueVariant = sensorObject->second["Value"];
val = std::visit(VariantToDoubleVisitor(), valueVariant);
return 0;
}
-const static boost::container::flat_map<const char *, std::string, CmpStr>
+const static boost::container::flat_map<const char*, std::string, CmpStr>
sensorUnitStr{{{"temperature", "C"},
{"voltage", "V"},
{"current", "mA"},
@@ -861,7 +862,7 @@
{"fan_pwm", "RPM"},
{"power", "W"}}};
-int getSensorUnit(std::string &name, std::string &unit)
+int getSensorUnit(std::string& name, std::string& unit)
{
std::string connection;
std::string path;
diff --git a/src/transportcommands.cpp b/src/transportcommands.cpp
index 2264a80..fb11144 100644
--- a/src/transportcommands.cpp
+++ b/src/transportcommands.cpp
@@ -15,6 +15,7 @@
*/
#include <ipmid/api.h>
+
#include <commandutils.hpp>
#define IPMI_CC_PARAMETER_NOT_SUPPORTED 0x80
@@ -51,8 +52,8 @@
ipmi_data_len_t data_len,
ipmi_context_t context)
{
- uint8_t *req = reinterpret_cast<uint8_t *>(request);
- uint8_t *res = reinterpret_cast<uint8_t *>(response);
+ uint8_t* req = reinterpret_cast<uint8_t*>(request);
+ uint8_t* res = reinterpret_cast<uint8_t*>(response);
uint8_t param = req[0];
uint8_t paramSel = req[1];
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index 501d8cb..7d5f74e 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -15,19 +15,20 @@
*/
#include <host-ipmid/ipmid-api.h>
-#include <nlohmann/json.hpp>
-#include <ipmid/api.hpp>
#include <stdbool.h>
#include <stdio.h>
#include <sys/stat.h>
-#include <fstream>
-#include <iostream>
-#include <sstream>
-#include <iomanip>
+#include <appcommands.hpp>
+#include <ipmid/api.hpp>
+#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/connection.hpp>
-#include <appcommands.hpp>
+
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
namespace ipmi
{
@@ -64,14 +65,14 @@
* debug card */
#define PHASE_ANY 0xff
-ipmi_ret_t getNetworkData(uint8_t lan_param, char *data);
-int8_t getFruData(std::string &serial, std::string &name);
+ipmi_ret_t getNetworkData(uint8_t lan_param, char* data);
+int8_t getFruData(std::string& serial, std::string& name);
/* Declare storage functions used here */
namespace storage
{
-int getSensorValue(std::string &, double &);
-int getSensorUnit(std::string &, std::string &);
+int getSensorValue(std::string&, double&);
+int getSensorUnit(std::string&, std::string&);
} // namespace storage
static constexpr bool DEBUG = false;
@@ -95,7 +96,7 @@
char title[32];
size_t max_size;
size_t max_page;
- char *buf;
+ char* buf;
uint16_t idx_head, idx_tail;
uint8_t line_per_page;
uint8_t line_width;
@@ -107,12 +108,12 @@
{
}
int init(size_t size);
- int append(const char *string, int indent);
- int insert(const char *string, int indent);
- int getPage(int page, char *page_buf, size_t page_buf_size);
+ int append(const char* string, int indent);
+ int insert(const char* string, int indent);
+ int getPage(int page, char* page_buf, size_t page_buf_size);
int isFull();
int isEscSeq(char chr);
- int parse(char *buf, size_t buf_size, const char *input, int indent);
+ int parse(char* buf, size_t buf_size, const char* input, int indent);
};
struct frame frame_info;
@@ -216,11 +217,11 @@
}
// return 0 on seccuess
-int frame::append(const char *string, int indent)
+int frame::append(const char* string, int indent)
{
const size_t buf_size = 64;
char lbuf[buf_size];
- char *ptr;
+ char* ptr;
int ret;
ret = parse(lbuf, buf_size, string, indent);
@@ -259,11 +260,11 @@
}
// return 0 on seccuess
-int frame::insert(const char *string, int indent)
+int frame::insert(const char* string, int indent)
{
const size_t buf_size = 128;
char lbuf[buf_size];
- char *ptr;
+ char* ptr;
int ret;
int i;
@@ -303,7 +304,7 @@
}
// return page size
-int frame::getPage(int page, char *page_buf, size_t page_buf_size)
+int frame::getPage(int page, char* page_buf, size_t page_buf_size)
{
int ret;
uint16_t line = 0;
@@ -386,7 +387,7 @@
}
// return 0 on success
-int frame::parse(char *lbuf, size_t buf_size, const char *input, int indent)
+int frame::parse(char* lbuf, size_t buf_size, const char* input, int indent)
{
uint8_t pos, esc;
int i;
@@ -453,9 +454,9 @@
return 0;
}
-static int chk_cri_sel_update(uint8_t *cri_sel_up)
+static int chk_cri_sel_update(uint8_t* cri_sel_up)
{
- FILE *fp;
+ FILE* fp;
struct stat file_stat;
uint8_t pos = plat_get_fru_sel();
static uint8_t pre_pos = 0xff;
@@ -489,13 +490,13 @@
return 0;
}
-int plat_udbg_get_frame_info(uint8_t *num)
+int plat_udbg_get_frame_info(uint8_t* num)
{
*num = 3;
return 0;
}
-int plat_udbg_get_updated_frames(uint8_t *count, uint8_t *buffer)
+int plat_udbg_get_updated_frames(uint8_t* count, uint8_t* buffer)
{
uint8_t cri_sel_up = 0;
uint8_t info_page_up = 1;
@@ -524,8 +525,8 @@
return 0;
}
-int plat_udbg_get_post_desc(uint8_t index, uint8_t *next, uint8_t phase,
- uint8_t *end, uint8_t *length, uint8_t *buffer)
+int plat_udbg_get_post_desc(uint8_t index, uint8_t* next, uint8_t phase,
+ uint8_t* end, uint8_t* length, uint8_t* buffer)
{
nlohmann::json postObj;
std::string postCode;
@@ -605,8 +606,8 @@
return -1;
}
-int plat_udbg_get_gpio_desc(uint8_t index, uint8_t *next, uint8_t *level,
- uint8_t *def, uint8_t *length, uint8_t *buffer)
+int plat_udbg_get_gpio_desc(uint8_t index, uint8_t* next, uint8_t* level,
+ uint8_t* def, uint8_t* length, uint8_t* buffer)
{
nlohmann::json gpioObj;
std::string gpioPin;
@@ -678,14 +679,14 @@
return -1;
}
-static int udbg_get_cri_sel(uint8_t frame, uint8_t page, uint8_t *next,
- uint8_t *count, uint8_t *buffer)
+static int udbg_get_cri_sel(uint8_t frame, uint8_t page, uint8_t* next,
+ uint8_t* count, uint8_t* buffer)
{
int len;
int ret;
char line_buff[FRAME_PAGE_BUF_SIZE], *fptr;
- const char *ptr;
- FILE *fp;
+ const char* ptr;
+ FILE* fp;
struct stat file_stat;
uint8_t pos = plat_get_fru_sel();
static uint8_t pre_pos = FRU_ALL;
@@ -748,7 +749,7 @@
return -1;
}
- ret = frame_sel.getPage(page, (char *)buffer, FRAME_PAGE_BUF_SIZE);
+ ret = frame_sel.getPage(page, (char*)buffer, FRAME_PAGE_BUF_SIZE);
if (ret < 0)
{
*count = 0;
@@ -765,8 +766,8 @@
return 0;
}
-static int udbg_get_cri_sensor(uint8_t frame, uint8_t page, uint8_t *next,
- uint8_t *count, uint8_t *buffer)
+static int udbg_get_cri_sensor(uint8_t frame, uint8_t page, uint8_t* next,
+ uint8_t* count, uint8_t* buffer)
{
int ret;
double fvalue;
@@ -798,7 +799,7 @@
}
/* Get sensors values for all critical sensors */
- for (auto &j : senObj.items())
+ for (auto& j : senObj.items())
{
std::string senName = j.key();
auto val = j.value();
@@ -844,7 +845,7 @@
return -1;
}
- ret = frame_snr.getPage(page, (char *)buffer, FRAME_PAGE_BUF_SIZE);
+ ret = frame_snr.getPage(page, (char*)buffer, FRAME_PAGE_BUF_SIZE);
if (ret < 0)
{
*count = 0;
@@ -861,7 +862,7 @@
return 0;
}
-static int getBiosVer(std::string &ver)
+static int getBiosVer(std::string& ver)
{
nlohmann::json appObj;
@@ -880,8 +881,8 @@
return -1;
}
-int sendMeCmd(uint8_t netFn, uint8_t cmd, std::vector<uint8_t> &cmdData,
- std::vector<uint8_t> &respData)
+int sendMeCmd(uint8_t netFn, uint8_t cmd, std::vector<uint8_t>& cmdData,
+ std::vector<uint8_t>& respData)
{
auto bus = getSdBus();
@@ -928,7 +929,7 @@
return 0;
}
-static int getMeStatus(std::string &status)
+static int getMeStatus(std::string& status)
{
uint8_t cmd = 0x01; // Get Device id command
uint8_t netFn = 0x06; // Netfn for APP
@@ -971,12 +972,12 @@
return 0;
}
-static int udbg_get_info_page(uint8_t frame, uint8_t page, uint8_t *next,
- uint8_t *count, uint8_t *buffer)
+static int udbg_get_info_page(uint8_t frame, uint8_t page, uint8_t* next,
+ uint8_t* count, uint8_t* buffer)
{
char line_buff[1000], *pres_dev = line_buff;
uint8_t pos = plat_get_fru_sel();
- const char *delim = "\n";
+ const char* delim = "\n";
int ret;
std::string serialName = "BOARD_SERIAL_NUMBER";
std::string partName = "BOARD_PART_NUMBER";
@@ -1074,7 +1075,7 @@
return -1;
}
- ret = frame_info.getPage(page, (char *)buffer, FRAME_PAGE_BUF_SIZE);
+ ret = frame_info.getPage(page, (char*)buffer, FRAME_PAGE_BUF_SIZE);
if (ret < 0)
{
*count = 0;
@@ -1091,8 +1092,8 @@
return 0;
}
-int plat_udbg_get_frame_data(uint8_t frame, uint8_t page, uint8_t *next,
- uint8_t *count, uint8_t *buffer)
+int plat_udbg_get_frame_data(uint8_t frame, uint8_t page, uint8_t* next,
+ uint8_t* count, uint8_t* buffer)
{
switch (frame)
{
@@ -1231,7 +1232,7 @@
}
int plat_udbg_control_panel(uint8_t panel, uint8_t operation, uint8_t item,
- uint8_t *count, uint8_t *buffer)
+ uint8_t* count, uint8_t* buffer)
{
if (panel > panelNum || panel < PANEL_MAIN)
return IPMI_CC_PARM_OUT_OF_RANGE;