diff options
author | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-03-25 14:17:54 -0700 |
---|---|---|
committer | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-04-11 18:20:31 +0000 |
commit | 11df4f6906edc0dfb23089a6e297158549c19ebd (patch) | |
tree | 8be3cfd12f12bf700ca525f2a5f839135ff655f0 /app/watchdog.cpp | |
parent | f2587fce3d3c5eb4a5e3127badc4dfa40a08785f (diff) | |
download | phosphor-host-ipmid-11df4f6906edc0dfb23089a6e297158549c19ebd.tar.gz phosphor-host-ipmid-11df4f6906edc0dfb23089a6e297158549c19ebd.zip |
rewrite Reset Watchdog Timer command to use new provider API
Modify to use the new provider API. One by one, change calls to
remove any legacy API constructs.
Tested-by: ipmitool mc watchdog get
ipmitool mc watchdog off
ipmitool mc watchdog reset
Change-Id: If6cd1d921908dc7f5462e99b0098b4897e743ebb
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'app/watchdog.cpp')
-rw-r--r-- | app/watchdog.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/app/watchdog.cpp b/app/watchdog.cpp index 51ba395..b1eea1c 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp @@ -38,15 +38,8 @@ void reportError() commit<InternalFailure>(); } -ipmi_ret_t ipmi_app_watchdog_reset(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::RspType<> ipmiAppResetWatchdogTimer() { - // We never return data with this command so immediately get rid of it - *data_len = 0; - try { WatchdogService wd_service; @@ -56,31 +49,33 @@ ipmi_ret_t ipmi_app_watchdog_reset(ipmi_netfn_t netfn, ipmi_cmd_t cmd, if (!wd_service.getInitialized()) { lastCallSuccessful = true; - return IPMI_WDOG_CC_NOT_INIT; + + constexpr uint8_t ccWatchdogNotInit = 0x80; + return ipmi::response(ccWatchdogNotInit); } // The ipmi standard dictates we enable the watchdog during reset wd_service.resetTimeRemaining(true); lastCallSuccessful = true; - return IPMI_CC_OK; + return ipmi::responseSuccess(); } catch (const InternalFailure& e) { reportError(); - return IPMI_CC_UNSPECIFIED_ERROR; + return ipmi::responseUnspecifiedError(); } catch (const std::exception& e) { const std::string e_str = std::string("wd_reset: ") + e.what(); log<level::ERR>(e_str.c_str()); reportError(); - return IPMI_CC_UNSPECIFIED_ERROR; + return ipmi::responseUnspecifiedError(); } catch (...) { log<level::ERR>("wd_reset: Unknown Error"); reportError(); - return IPMI_CC_UNSPECIFIED_ERROR; + return ipmi::responseUnspecifiedError(); } } |