app: update the method name
update watchdog names to use `Lower Camel Case`.
Change-Id: I654ddb1a37330f946f258c471fc4209e71cf4d82
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/app/watchdog.cpp b/app/watchdog.cpp
index aea13fd..e0c1e03 100644
--- a/app/watchdog.cpp
+++ b/app/watchdog.cpp
@@ -44,11 +44,11 @@
{
try
{
- WatchdogService wd_service;
+ WatchdogService wdService;
// Notify the caller if we haven't initialized our timer yet
// so it can configure actions and timeouts
- if (!wd_service.getInitialized())
+ if (!wdService.getInitialized())
{
lastCallSuccessful = true;
@@ -57,7 +57,7 @@
}
// The ipmi standard dictates we enable the watchdog during reset
- wd_service.resetTimeRemaining(true);
+ wdService.resetTimeRemaining(true);
lastCallSuccessful = true;
return ipmi::responseSuccess();
}
@@ -78,7 +78,7 @@
}
}
-static constexpr uint8_t wd_timeout_action_mask = 0x3;
+static constexpr uint8_t wdTimeoutActionMask = 0x3;
static constexpr uint8_t wdTimerUseResTimer1 = 0x0;
static constexpr uint8_t wdTimerUseResTimer2 = 0x6;
@@ -96,12 +96,12 @@
};
/** @brief Converts an IPMI Watchdog Action to DBUS defined action
- * @param[in] ipmi_action The IPMI Watchdog Action
- * @return The Watchdog Action that the ipmi_action maps to
+ * @param[in] ipmiAction The IPMI Watchdog Action
+ * @return The Watchdog Action that the ipmiAction maps to
*/
-WatchdogService::Action ipmiActionToWdAction(IpmiAction ipmi_action)
+WatchdogService::Action ipmiActionToWdAction(IpmiAction ipmiAction)
{
- switch (ipmi_action)
+ switch (ipmiAction)
{
case IpmiAction::None:
{
@@ -220,33 +220,33 @@
try
{
- WatchdogService wd_service;
+ WatchdogService wdService;
// Stop the timer if the don't stop bit is not set
if (!(dontStopTimer))
{
- wd_service.setEnabled(false);
+ wdService.setEnabled(false);
}
// Set the action based on the request
- const auto ipmi_action = static_cast<IpmiAction>(
- static_cast<uint8_t>(timeoutAction) & wd_timeout_action_mask);
- wd_service.setExpireAction(ipmiActionToWdAction(ipmi_action));
+ const auto ipmiAction = static_cast<IpmiAction>(
+ static_cast<uint8_t>(timeoutAction) & wdTimeoutActionMask);
+ wdService.setExpireAction(ipmiActionToWdAction(ipmiAction));
const auto ipmiTimerUse = types::enum_cast<IpmiTimerUse>(timerUse);
- wd_service.setTimerUse(ipmiTimerUseToWdTimerUse(ipmiTimerUse));
+ wdService.setTimerUse(ipmiTimerUseToWdTimerUse(ipmiTimerUse));
- wd_service.setExpiredTimerUse(WatchdogService::TimerUse::Reserved);
+ wdService.setExpiredTimerUse(WatchdogService::TimerUse::Reserved);
timerUseExpirationFlags &= ~expFlagValue;
// Set the new interval and the time remaining deci -> mill seconds
const uint64_t interval = initialCountdown * 100;
- wd_service.setInterval(interval);
- wd_service.resetTimeRemaining(false);
+ wdService.setInterval(interval);
+ wdService.resetTimeRemaining(false);
// Mark as initialized so that future resets behave correctly
- wd_service.setInitialized(true);
- wd_service.setLogTimeout(!dontLog);
+ wdService.setInitialized(true);
+ wdService.setLogTimeout(!dontLog);
lastCallSuccessful = true;
return ipmi::responseSuccess();
@@ -273,12 +273,12 @@
}
/** @brief Converts a DBUS Watchdog Action to IPMI defined action
- * @param[in] wd_action The DBUS Watchdog Action
- * @return The IpmiAction that the wd_action maps to
+ * @param[in] wdAction The DBUS Watchdog Action
+ * @return The IpmiAction that the wdAction maps to
*/
-IpmiAction wdActionToIpmiAction(WatchdogService::Action wd_action)
+IpmiAction wdActionToIpmiAction(WatchdogService::Action wdAction)
{
- switch (wd_action)
+ switch (wdAction)
{
case WatchdogService::Action::None:
{
@@ -374,26 +374,26 @@
try
{
- WatchdogService wd_service;
- WatchdogService::Properties wd_prop = wd_service.getProperties();
+ WatchdogService wdService;
+ WatchdogService::Properties wdProp = wdService.getProperties();
// Build and return the response
// Interval and timeRemaining need converted from milli -> deci seconds
- uint16_t initialCountdown = htole16(wd_prop.interval / 100);
+ uint16_t initialCountdown = htole16(wdProp.interval / 100);
- if (wd_prop.expiredTimerUse != WatchdogService::TimerUse::Reserved)
+ if (wdProp.expiredTimerUse != WatchdogService::TimerUse::Reserved)
{
timerUseExpirationFlags.set(static_cast<uint8_t>(
- wdTimerUseToIpmiTimerUse(wd_prop.expiredTimerUse)));
+ wdTimerUseToIpmiTimerUse(wdProp.expiredTimerUse)));
}
- if (wd_prop.enabled)
+ if (wdProp.enabled)
{
- presentCountdown = htole16(wd_prop.timeRemaining / 100);
+ presentCountdown = htole16(wdProp.timeRemaining / 100);
}
else
{
- if (wd_prop.expiredTimerUse == WatchdogService::TimerUse::Reserved)
+ if (wdProp.expiredTimerUse == WatchdogService::TimerUse::Reserved)
{
presentCountdown = initialCountdown;
}
@@ -411,10 +411,10 @@
lastCallSuccessful = true;
return ipmi::responseSuccess(
types::enum_cast<uint3_t>(
- wdTimerUseToIpmiTimerUse(wd_prop.timerUse)),
- 0, wd_prop.enabled, timerNotLogFlags,
+ wdTimerUseToIpmiTimerUse(wdProp.timerUse)),
+ 0, wdProp.enabled, timerNotLogFlags,
types::enum_cast<uint3_t>(
- wdActionToIpmiAction(wd_prop.expireAction)),
+ wdActionToIpmiAction(wdProp.expireAction)),
0, timerPreTimeoutInterrupt, 0, pretimeout, timerUseExpirationFlags,
initialCountdown, presentCountdown);
}
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index b67b5c7..da06041 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -21,18 +21,18 @@
using sdbusplus::error::xyz::openbmc_project::common::InternalFailure;
using sdbusplus::server::xyz::openbmc_project::state::Watchdog;
-static constexpr char wd_path[] = "/xyz/openbmc_project/watchdog/host0";
-static constexpr char wd_intf[] = "xyz.openbmc_project.State.Watchdog";
-static constexpr char prop_intf[] = "org.freedesktop.DBus.Properties";
+static constexpr auto wdPath = "/xyz/openbmc_project/watchdog/host0";
+static constexpr auto wdIntf = "xyz.openbmc_project.State.Watchdog";
+static constexpr auto propIntf = "org.freedesktop.DBus.Properties";
-ipmi::ServiceCache WatchdogService::wd_service(wd_intf, wd_path);
+ipmi::ServiceCache WatchdogService::wdService(wdIntf, wdPath);
WatchdogService::WatchdogService() : bus(ipmid_get_sd_bus_connection()) {}
void WatchdogService::resetTimeRemaining(bool enableWatchdog)
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, wd_intf, "ResetTimeRemaining");
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, wdIntf, "ResetTimeRemaining");
request.append(enableWatchdog);
try
{
@@ -40,7 +40,7 @@
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale
@@ -55,9 +55,9 @@
WatchdogService::Properties WatchdogService::getProperties()
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, prop_intf, "GetAll");
- request.append(wd_intf);
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, propIntf, "GetAll");
+ request.append(wdIntf);
std::map<std::string, std::variant<bool, uint64_t, std::string>> properties;
try
@@ -67,7 +67,7 @@
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale
@@ -80,20 +80,20 @@
try
{
- Properties wd_prop;
- wd_prop.initialized = std::get<bool>(properties.at("Initialized"));
- wd_prop.enabled = std::get<bool>(properties.at("Enabled"));
- wd_prop.expireAction = Watchdog::convertActionFromString(
+ Properties wdProp;
+ wdProp.initialized = std::get<bool>(properties.at("Initialized"));
+ wdProp.enabled = std::get<bool>(properties.at("Enabled"));
+ wdProp.expireAction = Watchdog::convertActionFromString(
std::get<std::string>(properties.at("ExpireAction")));
- wd_prop.timerUse = Watchdog::convertTimerUseFromString(
+ wdProp.timerUse = Watchdog::convertTimerUseFromString(
std::get<std::string>(properties.at("CurrentTimerUse")));
- wd_prop.expiredTimerUse = Watchdog::convertTimerUseFromString(
+ wdProp.expiredTimerUse = Watchdog::convertTimerUseFromString(
std::get<std::string>(properties.at("ExpiredTimerUse")));
- wd_prop.interval = std::get<uint64_t>(properties.at("Interval"));
- wd_prop.timeRemaining =
+ wdProp.interval = std::get<uint64_t>(properties.at("Interval"));
+ wdProp.timeRemaining =
std::get<uint64_t>(properties.at("TimeRemaining"));
- return wd_prop;
+ return wdProp;
}
catch (const std::exception& e)
{
@@ -111,9 +111,9 @@
template <typename T>
T WatchdogService::getProperty(const std::string& key)
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, prop_intf, "Get");
- request.append(wd_intf, key);
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, propIntf, "Get");
+ request.append(wdIntf, key);
try
{
auto response = bus.call(request);
@@ -123,7 +123,7 @@
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale
@@ -143,16 +143,16 @@
template <typename T>
void WatchdogService::setProperty(const std::string& key, const T& val)
{
- bool wasValid = wd_service.isValid(bus);
- auto request = wd_service.newMethodCall(bus, prop_intf, "Set");
- request.append(wd_intf, key, std::variant<T>(val));
+ bool wasValid = wdService.isValid(bus);
+ auto request = wdService.newMethodCall(bus, propIntf, "Set");
+ request.append(wdIntf, key, std::variant<T>(val));
try
{
auto response = bus.call(request);
}
catch (const std::exception& e)
{
- wd_service.invalidate();
+ wdService.invalidate();
if (wasValid)
{
// Retry the request once in case the cached service was stale
diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp
index 5717066..86c31da 100644
--- a/app/watchdog_service.hpp
+++ b/app/watchdog_service.hpp
@@ -102,7 +102,7 @@
/** @brief sdbusplus handle */
sdbusplus::bus_t bus;
/** @brief The name of the mapped host watchdog service */
- static ipmi::ServiceCache wd_service;
+ static ipmi::ServiceCache wdService;
/** @brief Gets the value of the property on the host watchdog
*