Consistently name AsyncResp variables
In about half of our code, AsyncResp objects take the name asyncResp,
and in the other half they take the name aResp. While the difference
between them is negligeble and arbitrary, having two naming conventions
makes it more difficult to do automated changes over time via grep.
This commit was generated automtatically with the command:
git grep -l 'aResp' | xargs sed -i 's|aResp|asyncResp|g'
Tested: Code compiles.
Change-Id: Id363437b6a78f51e91cbf60aa0a0c2286f36a037
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 56e2679..5e177ab 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -89,13 +89,13 @@
const std::pair<sdbusplus::message::object_path,
dbus::utility::DBusInteracesMap>&)>;
-inline void findAndParseObject(const std::string& service,
- const std::string& resName,
- const std::shared_ptr<bmcweb::AsyncResp>& aResp,
- CheckItemHandler&& handler)
+inline void
+ findAndParseObject(const std::string& service, const std::string& resName,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ CheckItemHandler&& handler)
{
crow::connections::systemBus->async_method_call(
- [service, resName, aResp,
+ [service, resName, asyncResp,
handler](const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& subtree) {
if (ec)
@@ -110,13 +110,13 @@
VmMode mode = parseObjectPathAndGetMode(item.first, resName);
if (mode != VmMode::Invalid)
{
- handler(service, resName, aResp, item);
+ handler(service, resName, asyncResp, item);
return;
}
}
BMCWEB_LOG_DEBUG << "Parent item not found";
- aResp->res.result(boost::beast::http::status::not_found);
+ asyncResp->res.result(boost::beast::http::status::not_found);
},
service, "/xyz/openbmc_project/VirtualMedia",
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
@@ -151,7 +151,7 @@
*/
inline void
vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interfaces,
- const std::shared_ptr<bmcweb::AsyncResp>& aResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
for (const auto& [interface, values] : interfaces)
{
@@ -170,10 +170,11 @@
if (!endpointIdValue->empty())
{
// Proxy mode
- aResp->res
+ asyncResp->res
.jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] =
*endpointIdValue;
- aResp->res.jsonValue["TransferProtocolType"] = "OEM";
+ asyncResp->res.jsonValue["TransferProtocolType"] =
+ "OEM";
}
}
if (property == "ImageURL")
@@ -187,19 +188,19 @@
{
// this will handle https share, which not
// necessarily has to have filename given.
- aResp->res.jsonValue["ImageName"] = "";
+ asyncResp->res.jsonValue["ImageName"] = "";
}
else
{
- aResp->res.jsonValue["ImageName"] =
+ asyncResp->res.jsonValue["ImageName"] =
filePath.filename();
}
- aResp->res.jsonValue["Image"] = *imageUrlValue;
- aResp->res.jsonValue["TransferProtocolType"] =
+ asyncResp->res.jsonValue["Image"] = *imageUrlValue;
+ asyncResp->res.jsonValue["TransferProtocolType"] =
getTransferProtocolTypeFromUri(*imageUrlValue);
- aResp->res.jsonValue["ConnectedVia"] =
+ asyncResp->res.jsonValue["ConnectedVia"] =
virtual_media::ConnectedVia::URI;
}
}
@@ -208,7 +209,7 @@
const bool* writeProtectedValue = std::get_if<bool>(&value);
if (writeProtectedValue != nullptr)
{
- aResp->res.jsonValue["WriteProtected"] =
+ asyncResp->res.jsonValue["WriteProtected"] =
*writeProtectedValue;
}
}
@@ -226,11 +227,11 @@
BMCWEB_LOG_DEBUG << "Value Active not found";
return;
}
- aResp->res.jsonValue["Inserted"] = *activeValue;
+ asyncResp->res.jsonValue["Inserted"] = *activeValue;
if (*activeValue)
{
- aResp->res.jsonValue["ConnectedVia"] =
+ asyncResp->res.jsonValue["ConnectedVia"] =
virtual_media::ConnectedVia::Applet;
}
}
@@ -267,13 +268,13 @@
/**
* @brief Fills collection data
*/
-inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> aResp,
+inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
const std::string& service,
const std::string& name)
{
BMCWEB_LOG_DEBUG << "Get available Virtual Media resources.";
crow::connections::systemBus->async_method_call(
- [name, aResp{std::move(aResp)}](
+ [name, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& subtree) {
if (ec)
@@ -281,7 +282,7 @@
BMCWEB_LOG_DEBUG << "DBUS response error";
return;
}
- nlohmann::json& members = aResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
for (const auto& object : subtree)
@@ -297,7 +298,7 @@
"/redfish/v1/Managers/{}/VirtualMedia/{}", name, path);
members.emplace_back(std::move(item));
}
- aResp->res.jsonValue["Members@odata.count"] = members.size();
+ asyncResp->res.jsonValue["Members@odata.count"] = members.size();
},
service, "/xyz/openbmc_project/VirtualMedia",
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
@@ -338,13 +339,13 @@
/**
* @brief Fills data for specific resource
*/
-inline void getVmData(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+inline void getVmData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& name,
const std::string& resName)
{
BMCWEB_LOG_DEBUG << "Get Virtual Media resource data.";
- findAndParseObject(service, resName, aResp,
+ findAndParseObject(service, resName, asyncResp,
std::bind_front(afterGetVmData, name));
}