clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I27b0d1357211259edb6ec2776924729052f238d6
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/util/dbus.cpp b/util/dbus.cpp
index 0f0416e..166ee30 100644
--- a/util/dbus.cpp
+++ b/util/dbus.cpp
@@ -10,8 +10,8 @@
{
//------------------------------------------------------------------------------
-constexpr auto objectMapperService = "xyz.openbmc_project.ObjectMapper";
-constexpr auto objectMapperPath = "/xyz/openbmc_project/object_mapper";
+constexpr auto objectMapperService = "xyz.openbmc_project.ObjectMapper";
+constexpr auto objectMapperPath = "/xyz/openbmc_project/object_mapper";
constexpr auto objectMapperInterface = "xyz.openbmc_project.ObjectMapper";
constexpr uint8_t terminusIdZero = 0;
@@ -44,10 +44,10 @@
{
// Response is a map of object paths to a map of service, interfaces
auto object = *(response.begin());
- o_path = object.first; // return path
- o_service = object.second.begin()->first; // return service
+ o_path = object.first; // return path
+ o_service = object.second.begin()->first; // return service
- rc = 0; // success
+ rc = 0; // success
}
}
catch (const sdbusplus::exception::SdBusError& e)
@@ -115,7 +115,7 @@
try
{
constexpr auto interface = "org.freedesktop.DBus.Properties";
- constexpr auto function = "Get";
+ constexpr auto function = "Get";
// calling the get property method
auto method = bus.new_method_call(i_service.c_str(), i_path.c_str(),
@@ -191,7 +191,7 @@
target = "obmc-chassis-hard-poweroff@0.target";
}
- auto bus = sdbusplus::bus::new_system();
+ auto bus = sdbusplus::bus::new_system();
auto method = bus.new_method_call(
"org.freedesktop.systemd1", "/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager", "StartUnit");
@@ -318,7 +318,7 @@
bool dumpPolicyEnabled = true;
constexpr auto interface = "xyz.openbmc_project.Object.Enable";
- constexpr auto path = "/xyz/openbmc_project/dump/system_dump_policy";
+ constexpr auto path = "/xyz/openbmc_project/dump/system_dump_policy";
DBusService service; // will find this
@@ -350,7 +350,7 @@
// Sdbus call specifics
constexpr auto interface = "org.open_power.Logging.PEL";
- constexpr auto path = "/xyz/openbmc_project/logging";
+ constexpr auto path = "/xyz/openbmc_project/logging";
// we need to find the service implementing the interface
util::dbus::DBusService service;
@@ -428,9 +428,9 @@
try
{
// Format the vector into a single hex string to compare to.
- std::string hexId =
- fmt::format("0x{:02x}{:02x}{:02x}{:02x}", ids.at(0),
- ids.at(1), ids.at(2), ids.at(3));
+ std::string hexId = fmt::format("0x{:02x}{:02x}{:02x}{:02x}",
+ ids.at(0), ids.at(1), ids.at(2),
+ ids.at(3));
std::map<std::string, MachineType> typeMap = {
{"0x50001000", MachineType::Rainier_2S4U},
@@ -467,10 +467,10 @@
bool getStateEffecterPdrs(std::vector<std::vector<uint8_t>>& pdrList,
uint16_t stateSetId)
{
- constexpr auto service = "xyz.openbmc_project.PLDM";
- constexpr auto path = "/xyz/openbmc_project/pldm";
+ constexpr auto service = "xyz.openbmc_project.PLDM";
+ constexpr auto path = "/xyz/openbmc_project/pldm";
constexpr auto interface = "xyz.openbmc_project.PLDM.PDR";
- constexpr auto function = "FindStateEffecterPDR";
+ constexpr auto function = "FindStateEffecterPDR";
constexpr uint16_t PLDM_ENTITY_PROC = 135;
@@ -478,8 +478,8 @@
{
// create dbus method
auto bus = sdbusplus::bus::new_default();
- sdbusplus::message_t method =
- bus.new_method_call(service, path, interface, function);
+ sdbusplus::message_t method = bus.new_method_call(service, path,
+ interface, function);
// append additional method data
method.append(terminusIdZero, PLDM_ENTITY_PROC, stateSetId);
@@ -502,10 +502,10 @@
bool getStateSensorPdrs(std::vector<std::vector<uint8_t>>& pdrList,
uint16_t stateSetId)
{
- constexpr auto service = "xyz.openbmc_project.PLDM";
- constexpr auto path = "/xyz/openbmc_project/pldm";
+ constexpr auto service = "xyz.openbmc_project.PLDM";
+ constexpr auto path = "/xyz/openbmc_project/pldm";
constexpr auto interface = "xyz.openbmc_project.PLDM.PDR";
- constexpr auto function = "FindStateSensorPDR";
+ constexpr auto function = "FindStateSensorPDR";
constexpr uint16_t PLDM_ENTITY_PROC = 135;
@@ -513,8 +513,8 @@
{
// create dbus method
auto bus = sdbusplus::bus::new_default();
- sdbusplus::message_t method =
- bus.new_method_call(service, path, interface, function);
+ sdbusplus::message_t method = bus.new_method_call(service, path,
+ interface, function);
// append additional method data
method.append(terminusIdZero, PLDM_ENTITY_PROC, stateSetId);
@@ -536,17 +536,17 @@
/** @brief Get MCTP instance associated with endpoint */
bool getMctpInstance(uint8_t& mctpInstance, uint8_t Eid)
{
- constexpr auto service = "xyz.openbmc_project.PLDM";
- constexpr auto path = "/xyz/openbmc_project/pldm";
+ constexpr auto service = "xyz.openbmc_project.PLDM";
+ constexpr auto path = "/xyz/openbmc_project/pldm";
constexpr auto interface = "xyz.openbmc_project.PLDM.Requester";
- constexpr auto function = "GetInstanceId";
+ constexpr auto function = "GetInstanceId";
try
{
// create dbus method
auto bus = sdbusplus::bus::new_default();
- sdbusplus::message_t method =
- bus.new_method_call(service, path, interface, function);
+ sdbusplus::message_t method = bus.new_method_call(service, path,
+ interface, function);
// append endpoint ID
method.append(Eid);
diff --git a/util/dbus.hpp b/util/dbus.hpp
index bbc50ad..1bf0d44 100644
--- a/util/dbus.hpp
+++ b/util/dbus.hpp
@@ -11,12 +11,12 @@
{
namespace dbus
{
-using DBusValue = std::variant<std::string, bool, std::vector<uint8_t>,
+using DBusValue = std::variant<std::string, bool, std::vector<uint8_t>,
std::vector<std::string>, int32_t>;
-using DBusProperty = std::string;
-using DBusInterface = std::string;
-using DBusService = std::string;
-using DBusPath = std::string;
+using DBusProperty = std::string;
+using DBusInterface = std::string;
+using DBusService = std::string;
+using DBusPath = std::string;
using DBusInterfaceList = std::vector<DBusInterface>;
using DBusSubTree =
std::map<DBusPath, std::map<DBusService, DBusInterfaceList>>;
diff --git a/util/ffdc.cpp b/util/ffdc.cpp
index e77012f..8f8069a 100644
--- a/util/ffdc.cpp
+++ b/util/ffdc.cpp
@@ -79,8 +79,8 @@
if (value == fieldValue)
{
// Get SYSLOG_IDENTIFIER field (process that logged message)
- std::string syslog =
- sdjGetFieldValue(journal, "SYSLOG_IDENTIFIER");
+ std::string syslog = sdjGetFieldValue(journal,
+ "SYSLOG_IDENTIFIER");
// Get _PID field
std::string pid = sdjGetFieldValue(journal, "_PID");
diff --git a/util/ffdc_file.hpp b/util/ffdc_file.hpp
index 64b5186..0e1e79e 100644
--- a/util/ffdc_file.hpp
+++ b/util/ffdc_file.hpp
@@ -37,12 +37,12 @@
{
public:
// Specify which compiler-generated methods we want
- FFDCFile() = delete;
- FFDCFile(const FFDCFile&) = delete;
- FFDCFile(FFDCFile&&) = default;
+ FFDCFile() = delete;
+ FFDCFile(const FFDCFile&) = delete;
+ FFDCFile(FFDCFile&&) = default;
FFDCFile& operator=(const FFDCFile&) = delete;
- FFDCFile& operator=(FFDCFile&&) = default;
- ~FFDCFile() = default;
+ FFDCFile& operator=(FFDCFile&&) = default;
+ ~FFDCFile() = default;
/**
* Constructor.
@@ -164,10 +164,9 @@
std::transform(i_files.begin(), i_files.end(), std::back_inserter(o_tuples),
[](const auto& e) {
- return FFDCTuple(
- e.getFormat(), e.getSubType(), e.getVersion(),
- sdbusplus::message::unix_fd(e.getFileDescriptor()));
- });
+ return FFDCTuple(e.getFormat(), e.getSubType(), e.getVersion(),
+ sdbusplus::message::unix_fd(e.getFileDescriptor()));
+ });
}
} // namespace util
diff --git a/util/file_descriptor.hpp b/util/file_descriptor.hpp
index 0fc2690..663658f 100644
--- a/util/file_descriptor.hpp
+++ b/util/file_descriptor.hpp
@@ -19,8 +19,8 @@
class FileDescriptor
{
public:
- FileDescriptor() = default;
- FileDescriptor(const FileDescriptor&) = delete;
+ FileDescriptor() = default;
+ FileDescriptor(const FileDescriptor&) = delete;
FileDescriptor& operator=(const FileDescriptor&) = delete;
/**
diff --git a/util/pdbg.cpp b/util/pdbg.cpp
index ab0b429..1ed25b0 100644
--- a/util/pdbg.cpp
+++ b/util/pdbg.cpp
@@ -222,19 +222,19 @@
// Rainier 4U
case util::dbus::MachineType::Rainier_2S4U:
case util::dbus::MachineType::Rainier_1S4U:
- filePath =
- fs::path{PACKAGE_DIR "util-data/peer-targets-rainier-4u.json"};
+ filePath = fs::path{PACKAGE_DIR
+ "util-data/peer-targets-rainier-4u.json"};
break;
// Rainier 2U
case util::dbus::MachineType::Rainier_2S2U:
case util::dbus::MachineType::Rainier_1S2U:
- filePath =
- fs::path{PACKAGE_DIR "util-data/peer-targets-rainier-2u.json"};
+ filePath = fs::path{PACKAGE_DIR
+ "util-data/peer-targets-rainier-2u.json"};
break;
// Everest
case util::dbus::MachineType::Everest:
- filePath =
- fs::path{PACKAGE_DIR "util-data/peer-targets-everest.json"};
+ filePath = fs::path{PACKAGE_DIR
+ "util-data/peer-targets-everest.json"};
break;
default:
trace::err("Invalid machine type found %d",
@@ -247,8 +247,8 @@
try
{
- auto trgtMap = nlohmann::json::parse(file);
- std::string rxPath = util::pdbg::getPath(i_rxTarget);
+ auto trgtMap = nlohmann::json::parse(file);
+ std::string rxPath = util::pdbg::getPath(i_rxTarget);
std::string peerPath = trgtMap.at(rxPath).get<std::string>();
o_peerTarget = util::pdbg::getTrgt(peerPath);
@@ -271,7 +271,7 @@
pdbg_target* txTarget = nullptr;
- auto rxType = util::pdbg::getTrgtType(i_rxTarget);
+ auto rxType = util::pdbg::getTrgtType(i_rxTarget);
std::string rxPath = util::pdbg::getPath(i_rxTarget);
if (callout::BusType::SMP_BUS == i_busType &&
diff --git a/util/pdbg.hpp b/util/pdbg.hpp
index fa2e004..0b46c7d 100644
--- a/util/pdbg.hpp
+++ b/util/pdbg.hpp
@@ -23,24 +23,24 @@
/** Chip target types. */
enum TargetType_t : uint8_t
{
- TYPE_DIMM = 0x03,
- TYPE_PROC = 0x05,
- TYPE_CORE = 0x07,
- TYPE_NX = 0x1e,
- TYPE_EQ = 0x23,
- TYPE_PEC = 0x2d,
- TYPE_PHB = 0x2e,
- TYPE_MC = 0x44,
- TYPE_IOLINK = 0x47,
- TYPE_OMI = 0x48,
- TYPE_MCC = 0x49,
- TYPE_OMIC = 0x4a,
- TYPE_OCMB = 0x4b,
+ TYPE_DIMM = 0x03,
+ TYPE_PROC = 0x05,
+ TYPE_CORE = 0x07,
+ TYPE_NX = 0x1e,
+ TYPE_EQ = 0x23,
+ TYPE_PEC = 0x2d,
+ TYPE_PHB = 0x2e,
+ TYPE_MC = 0x44,
+ TYPE_IOLINK = 0x47,
+ TYPE_OMI = 0x48,
+ TYPE_MCC = 0x49,
+ TYPE_OMIC = 0x4a,
+ TYPE_OCMB = 0x4b,
TYPE_MEM_PORT = 0x4c,
- TYPE_NMMU = 0x4f,
- TYPE_PAU = 0x50,
- TYPE_IOHS = 0x51,
- TYPE_PAUC = 0x52,
+ TYPE_NMMU = 0x4f,
+ TYPE_PAU = 0x50,
+ TYPE_IOHS = 0x51,
+ TYPE_PAUC = 0x52,
};
/** @return The target associated with the given chip. */
diff --git a/util/pldm.cpp b/util/pldm.cpp
index cdf1cfd..2da382d 100644
--- a/util/pldm.cpp
+++ b/util/pldm.cpp
@@ -82,7 +82,7 @@
// encode the message with state data
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
- auto rc = encode_set_state_effecter_states_req(
+ auto rc = encode_set_state_effecter_states_req(
mctpInstance, effecterId, effecterCount, stateField.data(), requestMsg);
if (rc != PLDM_SUCCESS)
@@ -136,7 +136,7 @@
if (possibleStates->state_set_id == stateSetId)
{
sensorOffset = offset;
- offsetFound = true;
+ offsetFound = true;
break;
}
possibleStatesPtr += sizeof(possibleStates->state_set_id) +
@@ -162,7 +162,7 @@
// map sensor ID to zero based SBE instance
unsigned int position = 0;
- for (auto const& pair : entityInstMap)
+ for (const auto& pair : entityInstMap)
{
sensorInstanceMap.emplace(pair.second, position);
position++;
@@ -213,9 +213,9 @@
if (possibleStates->state_set_id == stateSetId)
{
- stateIdPos = offset;
+ stateIdPos = offset;
effecterCount = stateEffecterPDR->composite_effecter_count;
- offsetFound = true;
+ offsetFound = true;
break;
}
possibleStatesPtr += sizeof(possibleStates->state_set_id) +
@@ -241,7 +241,7 @@
// map zero based SBE instance to effecter ID
unsigned int position = 0;
- for (auto const& pair : entityInstMap)
+ for (const auto& pair : entityInstMap)
{
instanceToEffecterMap.emplace(position, pair.second);
position++;
@@ -257,7 +257,7 @@
// get effecter info
std::map<unsigned int, uint16_t> sbeInstanceToEffecter;
- uint8_t SBEEffecterCount = 0;
+ uint8_t SBEEffecterCount = 0;
uint8_t sbeMaintenanceStatePosition = 0;
if (!fetchEffecterInfo(PLDM_OEM_IBM_SBE_MAINTENANCE_STATE,
@@ -300,8 +300,8 @@
// register signal change listener
std::string hresetStatus = "requested";
constexpr auto interface = "xyz.openbmc_project.PLDM.Event";
- constexpr auto path = "/xyz/openbmc_project/pldm";
- constexpr auto member = "StateSensorEvent";
+ constexpr auto path = "/xyz/openbmc_project/pldm";
+ constexpr auto member = "StateSensorEvent";
auto bus = sdbusplus::bus::new_default();
std::unique_ptr<sdbusplus::bus::match_t> match =
@@ -312,41 +312,40 @@
sdbusplus::bus::match::rules::path(path) +
sdbusplus::bus::match::rules::interface(interface),
[&](auto& msg) {
- uint8_t sensorTid{};
- uint16_t sensorId{};
- uint8_t msgSensorOffset{};
- uint8_t eventState{};
- uint8_t previousEventState{};
+ uint8_t sensorTid{};
+ uint16_t sensorId{};
+ uint8_t msgSensorOffset{};
+ uint8_t eventState{};
+ uint8_t previousEventState{};
- // get sensor event details
- msg.read(sensorTid, sensorId, msgSensorOffset, eventState,
- previousEventState);
+ // get sensor event details
+ msg.read(sensorTid, sensorId, msgSensorOffset, eventState,
+ previousEventState);
- // does sensor offset match?
- if (sbeSensorOffset == msgSensorOffset)
+ // does sensor offset match?
+ if (sbeSensorOffset == msgSensorOffset)
+ {
+ // does sensor ID match?
+ auto sensorEntry = sensorToSbeInstance.find(sensorId);
+ if (sensorEntry != sensorToSbeInstance.end())
+ {
+ const uint8_t instance = sensorEntry->second;
+
+ // if instances matche check status
+ if (instance == sbeInstance)
{
- // does sensor ID match?
- auto sensorEntry = sensorToSbeInstance.find(sensorId);
- if (sensorEntry != sensorToSbeInstance.end())
+ if (eventState == static_cast<uint8_t>(SBE_HRESET_READY))
{
- const uint8_t instance = sensorEntry->second;
-
- // if instances matche check status
- if (instance == sbeInstance)
- {
- if (eventState ==
- static_cast<uint8_t>(SBE_HRESET_READY))
- {
- hresetStatus = "success";
- }
- else if (eventState ==
- static_cast<uint8_t>(SBE_HRESET_FAILED))
- {
- hresetStatus = "fail";
- }
- }
+ hresetStatus = "success";
+ }
+ else if (eventState ==
+ static_cast<uint8_t>(SBE_HRESET_FAILED))
+ {
+ hresetStatus = "fail";
}
}
+ }
+ }
});
// send request to issue hreset of sbe
diff --git a/util/temporary_file.cpp b/util/temporary_file.cpp
index 0bd4d08..68b1d24 100644
--- a/util/temporary_file.cpp
+++ b/util/temporary_file.cpp
@@ -14,8 +14,8 @@
TemporaryFile::TemporaryFile()
{
// Build template path required by mkstemp()
- std::string templatePath =
- fs::temp_directory_path() / "openpower-hw-diags-XXXXXX";
+ std::string templatePath = fs::temp_directory_path() /
+ "openpower-hw-diags-XXXXXX";
// Generate unique file name, create file, and open it. The XXXXXX
// characters are replaced by mkstemp() to make the file name unique.
diff --git a/util/temporary_file.hpp b/util/temporary_file.hpp
index df0ab3c..3065401 100644
--- a/util/temporary_file.hpp
+++ b/util/temporary_file.hpp
@@ -26,7 +26,7 @@
{
public:
// Specify which compiler-generated methods we want
- TemporaryFile(const TemporaryFile&) = delete;
+ TemporaryFile(const TemporaryFile&) = delete;
TemporaryFile& operator=(const TemporaryFile&) = delete;
/**