diff options
author | Patrick Venture <venture@google.com> | 2018-08-31 11:55:55 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-09-07 23:45:41 +0000 |
commit | 0b02be925a29357f69abbc9e9a58e7c5aaed2eab (patch) | |
tree | c1b39f817d98ffda7b987f9e3f864f576e3bf9ea /softoff/softoff.cpp | |
parent | 26f80ab2cc41deadc913190d906f71266c4ed224 (diff) | |
download | phosphor-host-ipmid-0b02be925a29357f69abbc9e9a58e7c5aaed2eab.tar.gz phosphor-host-ipmid-0b02be925a29357f69abbc9e9a58e7c5aaed2eab.zip |
add .clang-format
Change-Id: I7c2a527b4751a560703a61fcbe9638b150546af5
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'softoff/softoff.cpp')
-rw-r--r-- | softoff/softoff.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp index d76750a..921536f 100644 --- a/softoff/softoff.cpp +++ b/softoff/softoff.cpp @@ -13,12 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "config.h" + +#include "softoff.hpp" + #include <chrono> #include <phosphor-logging/log.hpp> -#include <xyz/openbmc_project/Control/Host/server.hpp> #include <utils.hpp> -#include "softoff.hpp" -#include "config.h" +#include <xyz/openbmc_project/Control/Host/server.hpp> namespace phosphor { namespace ipmi @@ -29,16 +31,13 @@ using namespace sdbusplus::xyz::openbmc_project::Control::server; void SoftPowerOff::sendHostShutDownCmd() { - auto ctrlHostPath = std::string{CONTROL_HOST_OBJ_MGR} + '/' + - HOST_NAME + '0'; - auto host = ::ipmi::getService(this->bus, - CONTROL_HOST_BUSNAME, + auto ctrlHostPath = + std::string{CONTROL_HOST_OBJ_MGR} + '/' + HOST_NAME + '0'; + auto host = ::ipmi::getService(this->bus, CONTROL_HOST_BUSNAME, ctrlHostPath.c_str()); - auto method = bus.new_method_call(host.c_str(), - ctrlHostPath.c_str(), - CONTROL_HOST_BUSNAME, - "Execute"); + auto method = bus.new_method_call(host.c_str(), ctrlHostPath.c_str(), + CONTROL_HOST_BUSNAME, "Execute"); method.append(convertForMessage(Host::Command::SoftOff).c_str()); @@ -53,7 +52,6 @@ void SoftPowerOff::sendHostShutDownCmd() return; } - // Function called on host control signals void SoftPowerOff::hostControlEvent(sdbusplus::message::message& msg) { @@ -63,32 +61,33 @@ void SoftPowerOff::hostControlEvent(sdbusplus::message::message& msg) msg.read(cmdCompleted, cmdStatus); log<level::DEBUG>("Host control signal values", - entry("COMMAND=%s",cmdCompleted.c_str()), - entry("STATUS=%s",cmdStatus.c_str())); + entry("COMMAND=%s", cmdCompleted.c_str()), + entry("STATUS=%s", cmdStatus.c_str())); - if(Host::convertResultFromString(cmdStatus) == Host::Result::Success) + if (Host::convertResultFromString(cmdStatus) == Host::Result::Success) { // Set our internal property indicating we got host attention - sdbusplus::xyz::openbmc_project::Ipmi::Internal - ::server::SoftPowerOff::responseReceived( - HostResponse::SoftOffReceived); + sdbusplus::xyz::openbmc_project::Ipmi::Internal ::server::SoftPowerOff:: + responseReceived(HostResponse::SoftOffReceived); // Start timer for host shutdown using namespace std::chrono; auto time = duration_cast<microseconds>( - seconds(IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS)); + seconds(IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS)); auto r = startTimer(time); if (r < 0) { log<level::ERR>("Failure to start Host shutdown wait timer", - entry("ERRNO=0x%X", -r)); + entry("ERRNO=0x%X", -r)); } else { - log<level::INFO>("Timer started waiting for host to shutdown", + log<level::INFO>( + "Timer started waiting for host to shutdown", entry("TIMEOUT_IN_MSEC=%llu", - (duration_cast<milliseconds>(seconds - (IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS))).count())); + (duration_cast<milliseconds>( + seconds(IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS))) + .count())); } } else @@ -120,15 +119,15 @@ auto SoftPowerOff::responseReceived(HostResponse response) -> HostResponse if (r < 0) { log<level::ERR>("Failure to STOP the timer", - entry("ERRNO=0x%X", -r)); + entry("ERRNO=0x%X", -r)); } // This marks the completion of soft power off sequence. completed = true; } - return sdbusplus::xyz::openbmc_project::Ipmi::Internal - ::server::SoftPowerOff::responseReceived(response); + return sdbusplus::xyz::openbmc_project::Ipmi::Internal ::server:: + SoftPowerOff::responseReceived(response); } } // namespace ipmi |