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: I44441096113929ce96eb1439e2932e6ff3c87f27
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index f3d12c6..2a78c68 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -19,14 +19,9 @@
#include <dlfcn.h>
-#include <algorithm>
-#include <any>
#include <boost/algorithm/string.hpp>
#include <boost/asio/io_context.hpp>
#include <dcmihandler.hpp>
-#include <exception>
-#include <filesystem>
-#include <forward_list>
#include <host-cmd-manager.hpp>
#include <ipmid-host/cmd.hpp>
#include <ipmid/api.hpp>
@@ -34,9 +29,6 @@
#include <ipmid/message.hpp>
#include <ipmid/oemrouter.hpp>
#include <ipmid/types.hpp>
-#include <map>
-#include <memory>
-#include <optional>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/object_server.hpp>
@@ -44,6 +36,15 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/timer.hpp>
+
+#include <algorithm>
+#include <any>
+#include <exception>
+#include <filesystem>
+#include <forward_list>
+#include <map>
+#include <memory>
+#include <optional>
#include <tuple>
#include <unordered_map>
#include <utility>
@@ -285,8 +286,8 @@
return errorResponse(request, ccReqDataLenInvalid);
}
auto group = static_cast<Group>(bytes);
- message::Response::ptr response =
- executeIpmiCommandCommon(groupHandlerMap, group, request);
+ message::Response::ptr response = executeIpmiCommandCommon(groupHandlerMap,
+ group, request);
ipmi::message::Payload prefix;
prefix.pack(bytes);
response->prepend(prefix);
@@ -302,8 +303,8 @@
return errorResponse(request, ccReqDataLenInvalid);
}
auto iana = static_cast<Iana>(bytes);
- message::Response::ptr response =
- executeIpmiCommandCommon(oemHandlerMap, iana, request);
+ message::Response::ptr response = executeIpmiCommandCommon(oemHandlerMap,
+ iana, request);
ipmi::message::Payload prefix;
prefix.pack(bytes);
response->prepend(prefix);
@@ -351,28 +352,27 @@
conn.async_method_call(
[name](const boost::system::error_code ec,
const std::string& nameOwner) {
- if (ec)
- {
- log<level::ERR>("Error getting dbus owner",
- entry("INTERFACE=%s", name.c_str()));
- return;
- }
- // start after ipmiDbusChannelPrefix (after the '.')
- std::string chName =
- name.substr(std::strlen(ipmiDbusChannelMatch) + 1);
- try
- {
- uint8_t channel = getChannelByName(chName);
- uniqueNameToChannelNumber[nameOwner] = channel;
- log<level::INFO>("New interface mapping",
- entry("INTERFACE=%s", name.c_str()),
- entry("CHANNEL=%u", channel));
- }
- catch (const std::exception& e)
- {
- log<level::INFO>("Failed interface mapping, no such name",
- entry("INTERFACE=%s", name.c_str()));
- }
+ if (ec)
+ {
+ log<level::ERR>("Error getting dbus owner",
+ entry("INTERFACE=%s", name.c_str()));
+ return;
+ }
+ // start after ipmiDbusChannelPrefix (after the '.')
+ std::string chName = name.substr(std::strlen(ipmiDbusChannelMatch) + 1);
+ try
+ {
+ uint8_t channel = getChannelByName(chName);
+ uniqueNameToChannelNumber[nameOwner] = channel;
+ log<level::INFO>("New interface mapping",
+ entry("INTERFACE=%s", name.c_str()),
+ entry("CHANNEL=%u", channel));
+ }
+ catch (const std::exception& e)
+ {
+ log<level::INFO>("Failed interface mapping, no such name",
+ entry("INTERFACE=%s", name.c_str()));
+ }
},
"org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner",
name);
@@ -383,24 +383,24 @@
conn.async_method_call(
[&io, &conn](const boost::system::error_code ec,
std::vector<std::string> busNames) {
- if (ec)
- {
- log<level::ERR>("Error getting dbus names");
- std::exit(EXIT_FAILURE);
- return;
- }
- // Try to make startup consistent
- std::sort(busNames.begin(), busNames.end());
+ if (ec)
+ {
+ log<level::ERR>("Error getting dbus names");
+ std::exit(EXIT_FAILURE);
+ return;
+ }
+ // Try to make startup consistent
+ std::sort(busNames.begin(), busNames.end());
- const std::string channelPrefix =
- std::string(ipmiDbusChannelMatch) + ".";
- for (const std::string& busName : busNames)
+ const std::string channelPrefix = std::string(ipmiDbusChannelMatch) +
+ ".";
+ for (const std::string& busName : busNames)
+ {
+ if (busName.find(channelPrefix) == 0)
{
- if (busName.find(channelPrefix) == 0)
- {
- updateOwners(conn, busName);
- }
+ updateOwners(conn, busName);
}
+ }
},
"org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
"ListNames");
@@ -476,10 +476,10 @@
{
const auto dbusResponse =
[netFn, lun, cmd](Cc cc, const ipmi::SecureBuffer& data = {}) {
- constexpr uint8_t netFnResponse = 0x01;
- uint8_t retNetFn = netFn | netFnResponse;
- return std::make_tuple(retNetFn, lun, cmd, cc, data);
- };
+ constexpr uint8_t netFnResponse = 0x01;
+ uint8_t retNetFn = netFn | netFnResponse;
+ return std::make_tuple(retNetFn, lun, cmd, cc, data);
+ };
std::string sender = m.get_sender();
Privilege privilege = Privilege::None;
int rqSA = 0;
@@ -728,14 +728,10 @@
class LegacyRouter : public oem::Router
{
public:
- virtual ~LegacyRouter()
- {
- }
+ virtual ~LegacyRouter() {}
/// Enable message routing to begin.
- void activate() override
- {
- }
+ void activate() override {}
void registerHandler(Number oen, ipmi_cmd_t cmd, Handler handler) override
{
@@ -758,8 +754,8 @@
{
// make a copy so the next two moves don't wreak havoc on the stack
sdbusplus::message_t b{m};
- boost::asio::spawn(*getIoContext(), [b = std::move(b)](
- boost::asio::yield_context yield) {
+ boost::asio::spawn(*getIoContext(),
+ [b = std::move(b)](boost::asio::yield_context yield) {
sdbusplus::message_t m{std::move(b)};
unsigned char seq = 0, netFn = 0, lun = 0, cmd = 0;
ipmi::SecureBuffer data;
@@ -867,12 +863,12 @@
// set up boost::asio signal handling
std::function<SignalResponse(int)> stopAsioRunLoop =
[&io, &exitCode](int signalNumber) {
- log<level::INFO>("Received signal; quitting",
- entry("SIGNAL=%d", signalNumber));
- io->stop();
- exitCode = signalNumber;
- return SignalResponse::breakExecution;
- };
+ log<level::INFO>("Received signal; quitting",
+ entry("SIGNAL=%d", signalNumber));
+ io->stop();
+ exitCode = signalNumber;
+ return SignalResponse::breakExecution;
+ };
registerSignalHandler(ipmi::prioOpenBmcBase, SIGINT, stopAsioRunLoop);
registerSignalHandler(ipmi::prioOpenBmcBase, SIGTERM, stopAsioRunLoop);