add .clang-format
Add clang-format file to enable auto-formatting during development and
checking during CI.
Change-Id: I8389797fb47c019b8523057cb99486636efec623
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..ea71ad6
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,99 @@
+---
+Language: Cpp
+# BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: true
+ AfterEnum: true
+ AfterFunction: true
+ AfterNamespace: true
+ AfterObjCDeclaration: true
+ AfterStruct: true
+ AfterUnion: true
+ BeforeCatch: true
+ BeforeElse: true
+ IndentBraces: false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: AfterColon
+ColumnLimit: 80
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+PointerAlignment: Left
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 5
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.hpp"'
+ Priority: 1
+ - Regex: '^<.*\.h>'
+ Priority: 2
+ - Regex: '^<.*'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 4
+IndentCaseLabels: true
+IndentWidth: 4
+IndentWrappedFunctionNames: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 4
+UseTab: Never
+...
+
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 6eb9e21..7cf7a37 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -2,12 +2,12 @@
// See elog-gen.py for more details
#pragma once
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/exception.hpp>
#include <string>
#include <tuple>
#include <type_traits>
-#include <sdbusplus/exception.hpp>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
namespace sdbusplus
{
@@ -21,7 +21,7 @@
{
namespace Error
{
- struct Event;
+struct Event;
} // namespace Error
} // namespace Metrics
} // namespace OCC
@@ -29,7 +29,6 @@
} // namespace org
} // namespace sdbusplus
-
namespace phosphor
{
@@ -51,19 +50,18 @@
{
static constexpr auto str = "ESEL=%s";
static constexpr auto str_short = "ESEL";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr ESEL(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr ESEL(const char* a) : _entry(entry(str, a)){};
type _entry;
};
-} // namespace _Event
+} // namespace _Event
struct Event
{
static constexpr auto L = level::INFO;
using ESEL = _Event::ESEL;
using metadata_types = std::tuple<ESEL>;
-
};
} // namespace Metrics
@@ -71,17 +69,17 @@
} // namespace open_power
} // namespace org
-
namespace details
{
template <>
-struct map_exception_type<sdbusplus::org::open_power::OCC::Metrics::Error::Event>
+struct map_exception_type<
+ sdbusplus::org::open_power::OCC::Metrics::Error::Event>
{
using type = org::open_power::OCC::Metrics::Event;
};
-}
+} // namespace details
} // namespace logging
diff --git a/host-interface.cpp b/host-interface.cpp
index e00e07f..e2c3cad 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -1,11 +1,12 @@
+#include <config.h>
+
#include <chrono>
#include <functional>
-#include <oemhandler.hpp>
-#include <host-ipmid/ipmid-host-cmd.hpp>
-#include <host-ipmid/ipmid-host-cmd-utils.hpp>
-#include <phosphor-logging/log.hpp>
-#include <config.h>
#include <host-interface.hpp>
+#include <host-ipmid/ipmid-host-cmd-utils.hpp>
+#include <host-ipmid/ipmid-host-cmd.hpp>
+#include <oemhandler.hpp>
+#include <phosphor-logging/log.hpp>
namespace open_power
{
namespace host
@@ -22,21 +23,17 @@
// This is needed when invoking the callback handler to indicate
// the status of the executed command.
static const std::map<OEMCmd, Host::Command> intfCommand = {
- {
- IPMI_CMD_OCC_RESET,
- Base::Host::Command::OCCReset
- }
-};
+ {IPMI_CMD_OCC_RESET, Base::Host::Command::OCCReset}};
// Called at user request
void Host::execute(Base::Host::Command command,
- sdbusplus::message::variant<uint8_t> data)
+ sdbusplus::message::variant<uint8_t> data)
{
using namespace phosphor::logging;
- log<level::INFO>("Pushing cmd on to queue",
- entry("CONTROL_HOST_CMD=%s",
- convertForMessage(command).c_str()));
+ log<level::INFO>(
+ "Pushing cmd on to queue",
+ entry("CONTROL_HOST_CMD=%s", convertForMessage(command).c_str()));
// If the command is OCCReset, then all we need is just sensor ID
// This is the only command that is being used now.
@@ -45,9 +42,9 @@
auto sensorID = sdbusplus::message::variant_ns::get<uint8_t>(data);
auto cmd = std::make_tuple(std::make_pair(IPMI_CMD_OCC_RESET, sensorID),
- std::bind(&Host::commandStatusHandler,
- this, std::placeholders::_1,
- std::placeholders::_2));
+ std::bind(&Host::commandStatusHandler, this,
+ std::placeholders::_1,
+ std::placeholders::_2));
return ipmid_send_cmd_to_host(std::move(cmd));
}
@@ -66,4 +63,4 @@
} // namespace command
} // namespace host
-} // namepsace open_power
+} // namespace open_power
diff --git a/host-interface.hpp b/host-interface.hpp
index 4b92e18..c54e6ae 100644
--- a/host-interface.hpp
+++ b/host-interface.hpp
@@ -1,8 +1,8 @@
#pragma once
-#include <sdbusplus/bus.hpp>
#include <host-ipmid/ipmid-host-cmd-utils.hpp>
#include <org/open_power/Control/Host/server.hpp>
+#include <sdbusplus/bus.hpp>
namespace open_power
{
namespace host
@@ -20,46 +20,44 @@
*/
class Host : public sdbusplus::server::object::object<Base::Host>
{
- public:
- /** @brief Constructs Host Control Interface
- *
- * @param[in] bus - The Dbus bus object
- * @param[in] objPath - The Dbus object path
- */
- Host(sdbusplus::bus::bus& bus,
- const char* objPath) :
- sdbusplus::server::object::object<Base::Host>(bus, objPath),
- bus(bus)
- {
- // Nothing to do
- }
+ public:
+ /** @brief Constructs Host Control Interface
+ *
+ * @param[in] bus - The Dbus bus object
+ * @param[in] objPath - The Dbus object path
+ */
+ Host(sdbusplus::bus::bus& bus, const char* objPath) :
+ sdbusplus::server::object::object<Base::Host>(bus, objPath), bus(bus)
+ {
+ // Nothing to do
+ }
- /** @brief Sends input command to host
- * Note that the command will be queued in a FIFO if
- * other commands to the host have yet to be run
- *
- * @param[in] command - Input command to execute
- * @param[in] data - Data associated with the command
- */
- void execute(Command command,
- sdbusplus::message::variant<uint8_t> data) override;
+ /** @brief Sends input command to host
+ * Note that the command will be queued in a FIFO if
+ * other commands to the host have yet to be run
+ *
+ * @param[in] command - Input command to execute
+ * @param[in] data - Data associated with the command
+ */
+ void execute(Command command,
+ sdbusplus::message::variant<uint8_t> data) override;
- private:
- /** @brief sdbusplus DBus bus connection. */
- sdbusplus::bus::bus& bus;
+ private:
+ /** @brief sdbusplus DBus bus connection. */
+ sdbusplus::bus::bus& bus;
- /** @brief Callback function to be invoked by command manager
- *
- * @detail Conveys the status of the last Host bound command.
- * Depending on the status, a CommandComplete or
- * CommandFailure signal would be sent
- *
- * @param[in] cmd - IPMI command and data sent to Host
- * @param[in] status - Success or Failure
- */
- void commandStatusHandler(IpmiCmdData cmd, bool status);
+ /** @brief Callback function to be invoked by command manager
+ *
+ * @detail Conveys the status of the last Host bound command.
+ * Depending on the status, a CommandComplete or
+ * CommandFailure signal would be sent
+ *
+ * @param[in] cmd - IPMI command and data sent to Host
+ * @param[in] status - Success or Failure
+ */
+ void commandStatusHandler(IpmiCmdData cmd, bool status);
};
} // namespace command
} // namespace host
-} // namespace phosphor
+} // namespace open_power
diff --git a/local_users.cpp b/local_users.cpp
index aa6519c..d3ea159 100644
--- a/local_users.cpp
+++ b/local_users.cpp
@@ -1,5 +1,7 @@
#include "config.h"
+
#include "local_users.hpp"
+
#include <host-ipmid/ipmid-host-cmd.hpp>
#include <phosphor-logging/log.hpp>
@@ -16,8 +18,8 @@
using DbusObjectPath = std::string;
using DbusService = std::string;
using DbusInterface = std::string;
-using ObjectTree = std::map<DbusObjectPath,
- std::map<DbusService, std::vector<DbusInterface>>>;
+using ObjectTree =
+ std::map<DbusObjectPath, std::map<DbusService, std::vector<DbusInterface>>>;
/**
* @brief Gets a list of all local users in the form of GetSubTree
@@ -32,12 +34,10 @@
try
{
- auto method = bus->new_method_call(MAPPER_BUS_NAME,
- MAPPER_OBJ,
- MAPPER_IFACE,
- "GetSubTree");
+ auto method = bus->new_method_call(MAPPER_BUS_NAME, MAPPER_OBJ,
+ MAPPER_IFACE, "GetSubTree");
method.append("/xyz/openbmc_project/user/", 0,
- std::vector<std::string>{userIface});
+ std::vector<std::string>{userIface});
auto reply = bus->call(method);
if (reply.is_method_error())
@@ -65,10 +65,8 @@
try
{
- auto method = bus->new_method_call(service.c_str(),
- path.c_str(),
- propIface,
- "Set");
+ auto method = bus->new_method_call(service.c_str(), path.c_str(),
+ propIface, "Set");
sdbusplus::message::variant<bool> enabled{true};
method.append(userIface, "UserEnabled", enabled);
@@ -100,12 +98,12 @@
catch (std::runtime_error& e)
{
log<level::ERR>("Failed enabling local users",
- entry("ERROR=%s", e.what()));
+ entry("ERROR=%s", e.what()));
return IPMI_CC_UNSPECIFIED_ERROR;
}
return IPMI_CC_OK;
}
-}
-}
+} // namespace users
+} // namespace local
diff --git a/local_users.hpp b/local_users.hpp
index e447a25..ac9294f 100644
--- a/local_users.hpp
+++ b/local_users.hpp
@@ -17,5 +17,5 @@
*/
ipmi_ret_t enableUsers();
-}
-}
+} // namespace users
+} // namespace local
diff --git a/oemhandler.cpp b/oemhandler.cpp
index c793941..a66f3e6 100644
--- a/oemhandler.cpp
+++ b/oemhandler.cpp
@@ -1,37 +1,40 @@
-#include "oemhandler.hpp"
#include "config.h"
+
+#include "oemhandler.hpp"
+
#include "elog-errors.hpp"
#include "local_users.hpp"
+
+#include <endian.h>
#include <host-ipmid/ipmid-api.h>
-#include <host-ipmid/ipmid-host-cmd.hpp>
-#include <fstream>
-#include <memory>
#include <stdio.h>
#include <string.h>
-#include <endian.h>
-#include <functional>
#include <systemd/sd-bus.h>
-#include <sdbusplus/bus.hpp>
+
+#include <fstream>
+#include <functional>
#include <host-interface.hpp>
+#include <host-ipmid/ipmid-host-cmd.hpp>
+#include <memory>
#include <org/open_power/OCC/Metrics/error.hpp>
+#include <sdbusplus/bus.hpp>
void register_netfn_ibm_oem_commands() __attribute__((constructor));
-const char *g_esel_path = "/tmp/esel";
+const char* g_esel_path = "/tmp/esel";
uint16_t g_record_id = 0x0001;
using namespace phosphor::logging;
constexpr auto occMetricsType = 0xDD;
std::string readESEL(const char* fileName)
{
- std::string content {};
+ std::string content{};
std::ifstream handle(fileName);
if (handle.fail())
{
- log<level::ERR>("Failed to open eSEL",
- entry("FILENAME=%s", fileName));
+ log<level::ERR>("Failed to open eSEL", entry("FILENAME=%s", fileName));
return content;
}
@@ -50,8 +53,8 @@
// insert '/0' at the end of the character array.
constexpr auto byteSeperator = 3;
- std::unique_ptr<char[]> data(new char[
- (eSELData.size() * byteSeperator) + 1]());
+ std::unique_ptr<char[]> data(
+ new char[(eSELData.size() * byteSeperator) + 1]());
for (size_t i = 0; i < eSELData.size(); i++)
{
@@ -59,13 +62,12 @@
}
data[eSELData.size() * byteSeperator] = '\0';
- using error = sdbusplus::org::open_power::OCC::Metrics::Error::Event;
+ using error = sdbusplus::org::open_power::OCC::Metrics::Error::Event;
using metadata = org::open_power::OCC::Metrics::Event;
report<error>(metadata::ESEL(data.get()));
}
-
///////////////////////////////////////////////////////////////////////////////
// For the First partial add eSEL the SEL Record ID and offset
// value should be 0x0000. The extended data needs to be in
@@ -79,79 +81,86 @@
// storage. Likely via the ipmi add_sel command.
///////////////////////////////////////////////////////////////////////////////
ipmi_ret_t ipmi_ibm_oem_partial_esel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request, ipmi_response_t response,
- ipmi_data_len_t data_len, ipmi_context_t context)
+ ipmi_request_t request,
+ ipmi_response_t response,
+ ipmi_data_len_t data_len,
+ ipmi_context_t context)
{
- uint8_t *reqptr = (uint8_t *) request;
- esel_request_t esel_req;
- FILE *fp;
- int r = 0;
- uint8_t rlen;
- ipmi_ret_t rc = IPMI_CC_OK;
- const char *pio;
+ uint8_t* reqptr = (uint8_t*)request;
+ esel_request_t esel_req;
+ FILE* fp;
+ int r = 0;
+ uint8_t rlen;
+ ipmi_ret_t rc = IPMI_CC_OK;
+ const char* pio;
- esel_req.resid = le16toh((((uint16_t) reqptr[1]) << 8) + reqptr[0]);
- esel_req.selrecord = le16toh((((uint16_t) reqptr[3]) << 8) + reqptr[2]);
- esel_req.offset = le16toh((((uint16_t) reqptr[5]) << 8) + reqptr[4]);
- esel_req.progress = reqptr[6];
+ esel_req.resid = le16toh((((uint16_t)reqptr[1]) << 8) + reqptr[0]);
+ esel_req.selrecord = le16toh((((uint16_t)reqptr[3]) << 8) + reqptr[2]);
+ esel_req.offset = le16toh((((uint16_t)reqptr[5]) << 8) + reqptr[4]);
+ esel_req.progress = reqptr[6];
- // According to IPMI spec, Reservation ID must be checked.
- if ( !checkSELReservation(esel_req.resid) ) {
- // 0xc5 means Reservation Cancelled or Invalid Reservation ID.
- printf("Used Reservation ID = %d\n", esel_req.resid);
- rc = IPMI_CC_INVALID_RESERVATION_ID;
+ // According to IPMI spec, Reservation ID must be checked.
+ if (!checkSELReservation(esel_req.resid))
+ {
+ // 0xc5 means Reservation Cancelled or Invalid Reservation ID.
+ printf("Used Reservation ID = %d\n", esel_req.resid);
+ rc = IPMI_CC_INVALID_RESERVATION_ID;
- // clean g_esel_path.
- r = remove(g_esel_path);
- if(r < 0)
- fprintf(stderr, "Error deleting %s\n", g_esel_path);
+ // clean g_esel_path.
+ r = remove(g_esel_path);
+ if (r < 0)
+ fprintf(stderr, "Error deleting %s\n", g_esel_path);
- return rc;
- }
+ return rc;
+ }
// OpenPOWER Host Interface spec says if RecordID and Offset are
- // 0 then then this is a new request
- if (!esel_req.selrecord && !esel_req.offset)
- pio = "wb";
- else
- pio = "rb+";
+ // 0 then then this is a new request
+ if (!esel_req.selrecord && !esel_req.offset)
+ pio = "wb";
+ else
+ pio = "rb+";
- rlen = (*data_len) - (uint8_t) (sizeof(esel_request_t));
+ rlen = (*data_len) - (uint8_t)(sizeof(esel_request_t));
- if ((fp = fopen(g_esel_path, pio)) != NULL) {
- fseek(fp, esel_req.offset, SEEK_SET);
- fwrite(reqptr+(uint8_t) (sizeof(esel_request_t)), rlen, 1, fp);
- fclose(fp);
-
- *data_len = sizeof(g_record_id);
- memcpy(response, &g_record_id, *data_len);
- } else {
- fprintf(stderr, "Error trying to perform %s for esel%s\n",pio, g_esel_path);
- rc = IPMI_CC_INVALID;
- *data_len = 0;
- }
-
- // The first bit presents that this is the last partial packet
- // coming down. If that is the case advance the record id so we
- // don't overlap logs. This allows anyone to establish a log
- // directory system.
- if (esel_req.progress & 1 )
+ if ((fp = fopen(g_esel_path, pio)) != NULL)
{
- g_record_id++;
+ fseek(fp, esel_req.offset, SEEK_SET);
+ fwrite(reqptr + (uint8_t)(sizeof(esel_request_t)), rlen, 1, fp);
+ fclose(fp);
- auto eSELData = readESEL(g_esel_path);
+ *data_len = sizeof(g_record_id);
+ memcpy(response, &g_record_id, *data_len);
+ }
+ else
+ {
+ fprintf(stderr, "Error trying to perform %s for esel%s\n", pio,
+ g_esel_path);
+ rc = IPMI_CC_INVALID;
+ *data_len = 0;
+ }
- if (eSELData.empty())
- {
- return IPMI_CC_UNSPECIFIED_ERROR;
- }
+ // The first bit presents that this is the last partial packet
+ // coming down. If that is the case advance the record id so we
+ // don't overlap logs. This allows anyone to establish a log
+ // directory system.
+ if (esel_req.progress & 1)
+ {
+ g_record_id++;
- // If the eSEL record type is OCC metrics, then create the OCC log
- // entry.
- if (eSELData[2] == occMetricsType)
- {
- createOCCLogEntry(eSELData);
- }
+ auto eSELData = readESEL(g_esel_path);
+
+ if (eSELData.empty())
+ {
+ return IPMI_CC_UNSPECIFIED_ERROR;
+ }
+
+ // If the eSEL record type is OCC metrics, then create the OCC log
+ // entry.
+ if (eSELData[2] == occMetricsType)
+ {
+ createOCCLogEntry(eSELData);
+ }
}
return rc;
@@ -160,40 +169,46 @@
// Prepare for FW Update.
// Execute needed commands to prepare the system for a fw update from the host.
ipmi_ret_t ipmi_ibm_oem_prep_fw_update(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request, ipmi_response_t response,
- ipmi_data_len_t data_len, ipmi_context_t context)
+ ipmi_request_t request,
+ ipmi_response_t response,
+ ipmi_data_len_t data_len,
+ ipmi_context_t context)
{
ipmi_ret_t ipmi_rc = IPMI_CC_OK;
*data_len = 0;
int rc = 0;
std::ofstream rwfs_file;
- const char *busname = "org.openbmc.control.Bmc";
- const char *objname = "/org/openbmc/control/bmc0";
- const char *iface = "org.openbmc.control.Bmc";
- sd_bus *bus = ipmid_get_sd_bus_connection();
- sd_bus_message *reply = NULL;
+ const char* busname = "org.openbmc.control.Bmc";
+ const char* objname = "/org/openbmc/control/bmc0";
+ const char* iface = "org.openbmc.control.Bmc";
+ sd_bus* bus = ipmid_get_sd_bus_connection();
+ sd_bus_message* reply = NULL;
sd_bus_error error = SD_BUS_ERROR_NULL;
int r = 0;
// Set one time flag
- rc = system("fw_setenv openbmconce copy-files-to-ram copy-base-filesystem-to-ram");
+ rc = system(
+ "fw_setenv openbmconce copy-files-to-ram copy-base-filesystem-to-ram");
rc = WEXITSTATUS(rc);
- if (rc != 0) {
+ if (rc != 0)
+ {
fprintf(stderr, "fw_setenv openbmconce failed with rc=%d\n", rc);
return IPMI_CC_UNSPECIFIED_ERROR;
}
// Touch the image-rwfs file to perform an empty update to force the save
- // in case we're already in ram and the flash is the same causing the ram files
- // to not be copied back to flash
- rwfs_file.open("/run/initramfs/image-rwfs", std::ofstream::out | std::ofstream::app);
+ // in case we're already in ram and the flash is the same causing the ram
+ // files to not be copied back to flash
+ rwfs_file.open("/run/initramfs/image-rwfs",
+ std::ofstream::out | std::ofstream::app);
rwfs_file.close();
// Reboot the BMC for settings to take effect
- r = sd_bus_call_method(bus, busname, objname, iface,
- "warmReset", &error, &reply, NULL);
- if (r < 0) {
+ r = sd_bus_call_method(bus, busname, objname, iface, "warmReset", &error,
+ &reply, NULL);
+ if (r < 0)
+ {
fprintf(stderr, "Failed to reset BMC: %s\n", strerror(-r));
return -1;
}
@@ -217,23 +232,26 @@
return rc;
}
-namespace {
+namespace
+{
// Storage to keep the object alive during process life
std::unique_ptr<open_power::host::command::Host> opHost
- __attribute__((init_priority(101)));
+ __attribute__((init_priority(101)));
std::unique_ptr<sdbusplus::server::manager::manager> objManager
- __attribute__((init_priority(101)));
-}
+ __attribute__((init_priority(101)));
+} // namespace
void register_netfn_ibm_oem_commands()
{
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_IBM_OEM, IPMI_CMD_PESEL);
- ipmi_register_callback(NETFUN_IBM_OEM, IPMI_CMD_PESEL, NULL, ipmi_ibm_oem_partial_esel,
- SYSTEM_INTERFACE);
+ printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_IBM_OEM,
+ IPMI_CMD_PESEL);
+ ipmi_register_callback(NETFUN_IBM_OEM, IPMI_CMD_PESEL, NULL,
+ ipmi_ibm_oem_partial_esel, SYSTEM_INTERFACE);
- printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_OEM, IPMI_CMD_PREP_FW_UPDATE);
- ipmi_register_callback(NETFUN_OEM, IPMI_CMD_PREP_FW_UPDATE, NULL, ipmi_ibm_oem_prep_fw_update,
- SYSTEM_INTERFACE);
+ printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_OEM,
+ IPMI_CMD_PREP_FW_UPDATE);
+ ipmi_register_callback(NETFUN_OEM, IPMI_CMD_PREP_FW_UPDATE, NULL,
+ ipmi_ibm_oem_prep_fw_update, SYSTEM_INTERFACE);
ipmi_register_callback(NETFUN_IBM_OEM, IPMI_CMD_RESET_BMC_AUTH, NULL,
ipmi_ibm_oem_reset_bmc_auth, SYSTEM_INTERFACE);
@@ -244,11 +262,10 @@
// Add sdbusplus ObjectManager.
auto& sdbusPlusHandler = ipmid_get_sdbus_plus_handler();
objManager = std::make_unique<sdbusplus::server::manager::manager>(
- *sdbusPlusHandler,
- CONTROL_HOST_OBJ_MGR);
+ *sdbusPlusHandler, CONTROL_HOST_OBJ_MGR);
opHost = std::make_unique<open_power::host::command::Host>(
- *sdbusPlusHandler, objPath.c_str());
+ *sdbusPlusHandler, objPath.c_str());
// Service for this is provided by phosphor layer systemcmdintf
// and this will be as part of that.
diff --git a/oemhandler.hpp b/oemhandler.hpp
index 097d4b4..a98ae95 100644
--- a/oemhandler.hpp
+++ b/oemhandler.hpp
@@ -1,10 +1,10 @@
#ifndef __HOST_IPMI_OPENPOWEROEM_HANDLER_H__
#define __HOST_IPMI_OPENPOWEROEM_HANDLER_H__
-#include <stdint.h>
#include <host-ipmid/ipmid-api.h>
-#include <string>
+#include <stdint.h>
+#include <string>
// IPMI commands for net functions.
enum ipmi_netfn_oem_cmds
@@ -30,17 +30,17 @@
void createLogEntry(const std::string& eSELData);
ipmi_ret_t ipmi_ibm_oem_partial_esel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_request_t request, ipmi_response_t response,
- ipmi_data_len_t data_len, ipmi_context_t context);
+ ipmi_request_t request,
+ ipmi_response_t response,
+ ipmi_data_len_t data_len,
+ ipmi_context_t context);
-
-struct esel_request_t {
- uint16_t resid;
- uint16_t selrecord;
- uint16_t offset;
- uint8_t progress;
-} __attribute__ ((packed)) ;
-
-
+struct esel_request_t
+{
+ uint16_t resid;
+ uint16_t selrecord;
+ uint16_t offset;
+ uint8_t progress;
+} __attribute__((packed));
#endif