Remove unused settings.cpp/settings.hpp
These two files are no longer used now that netipmid is just a bridge
to send commands onto ipmid. This removes them.
Tested: Compile and run netipmid. Because they are unused, behavior is
unchanged.
Change-Id: I24c9f30822050fc89028945b380fbc471a5c5b88
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/Makefile.am b/Makefile.am
index 10dac91..dbbbcd8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -55,9 +55,7 @@
command/payload_cmds.hpp \
command/payload_cmds.cpp \
sol_module.hpp \
- sol_module.cpp \
- settings.hpp \
- settings.cpp
+ sol_module.cpp
netipmid_CPPFLAGS = -DNET_IPMID_LIB_PATH=\"/usr/lib/net-ipmid/\"
diff --git a/settings.cpp b/settings.cpp
deleted file mode 100644
index bbe8611..0000000
--- a/settings.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-#include "settings.hpp"
-
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/message/types.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
-
-namespace settings
-{
-
-using namespace phosphor::logging;
-using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-namespace variant_ns = sdbusplus::message::variant_ns;
-
-constexpr auto mapperService = "xyz.openbmc_project.ObjectMapper";
-constexpr auto mapperPath = "/xyz/openbmc_project/object_mapper";
-constexpr auto mapperIntf = "xyz.openbmc_project.ObjectMapper";
-
-Objects::Objects(sdbusplus::bus::bus& bus,
- const std::vector<Interface>& filter) :
- bus(bus)
-{
- auto depth = 0;
-
- auto mapperCall = bus.new_method_call(mapperService, mapperPath, mapperIntf,
- "GetSubTree");
- mapperCall.append(root);
- mapperCall.append(depth);
- mapperCall.append(filter);
- auto response = bus.call(mapperCall);
- if (response.is_method_error())
- {
- log<level::ERR>("Error in mapper GetSubTree");
- elog<InternalFailure>();
- }
-
- using Interfaces = std::vector<Interface>;
- using MapperResponse = std::map<Path, std::map<Service, Interfaces>>;
- MapperResponse result;
- response.read(result);
- if (result.empty())
- {
- log<level::ERR>("Invalid response from mapper");
- elog<InternalFailure>();
- }
-
- for (auto& iter : result)
- {
- const auto& path = iter.first;
- for (auto& interface : iter.second.begin()->second)
- {
- auto found = map.find(interface);
- if (map.end() != found)
- {
- auto& paths = found->second;
- paths.push_back(path);
- }
- else
- {
- map.emplace(std::move(interface), std::vector<Path>({path}));
- }
- }
- }
-}
-
-Service Objects::service(const Path& path, const Interface& interface) const
-{
- using Interfaces = std::vector<Interface>;
- auto mapperCall =
- bus.new_method_call(mapperService, mapperPath, mapperIntf, "GetObject");
- mapperCall.append(path);
- mapperCall.append(Interfaces({interface}));
-
- auto response = bus.call(mapperCall);
- if (response.is_method_error())
- {
- log<level::ERR>("Error in mapper GetObject");
- elog<InternalFailure>();
- }
-
- std::map<Service, Interfaces> result;
- response.read(result);
- if (result.empty())
- {
- log<level::ERR>("Invalid response from mapper");
- elog<InternalFailure>();
- }
-
- return result.begin()->first;
-}
-
-namespace boot
-{
-
-std::tuple<Path, OneTimeEnabled> setting(const Objects& objects,
- const Interface& iface)
-{
- constexpr auto bootObjCount = 2;
- constexpr auto oneTime = "one_time";
- constexpr auto enabledIntf = "xyz.openbmc_project.Object.Enable";
- constexpr auto propIntf = "org.freedesktop.DBus.Properties";
-
- const std::vector<Path>& paths = objects.map.at(iface);
- auto count = paths.size();
- if (count != bootObjCount)
- {
- log<level::ERR>("Exactly two objects expected",
- entry("INTERFACE=%s", iface.c_str()),
- entry("COUNT=%d", count));
- elog<InternalFailure>();
- }
- size_t index = 0;
- if (std::string::npos == paths[0].rfind(oneTime))
- {
- index = 1;
- }
- const Path& oneTimeSetting = paths[index];
- const Path& regularSetting = paths[!index];
-
- auto method = objects.bus.new_method_call(
- objects.service(oneTimeSetting, iface).c_str(), oneTimeSetting.c_str(),
- propIntf, "Get");
- method.append(enabledIntf, "Enabled");
- auto reply = objects.bus.call(method);
- if (reply.is_method_error())
- {
- log<level::ERR>("Error in getting Enabled property",
- entry("OBJECT=%s", oneTimeSetting.c_str()),
- entry("INTERFACE=%s", iface.c_str()));
- elog<InternalFailure>();
- }
-
- sdbusplus::message::variant<bool> enabled;
- reply.read(enabled);
- auto oneTimeEnabled = variant_ns::get<bool>(enabled);
- const Path& setting = oneTimeEnabled ? oneTimeSetting : regularSetting;
- return std::make_tuple(setting, oneTimeEnabled);
-}
-
-} // namespace boot
-
-} // namespace settings
diff --git a/settings.hpp b/settings.hpp
deleted file mode 100644
index 5382fdd..0000000
--- a/settings.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#pragma once
-
-#include <sdbusplus/bus.hpp>
-#include <string>
-#include <tuple>
-
-namespace settings
-{
-
-using Path = std::string;
-using Service = std::string;
-using Interface = std::string;
-
-constexpr auto root = "/";
-
-/** @class Objects
- * @brief Fetch paths of settings d-bus objects of interest, upon construction
- */
-struct Objects
-{
- public:
- /** @brief Constructor - fetch settings objects
- *
- * @param[in] bus - The Dbus bus object
- * @param[in] filter - A vector of settings interfaces the caller is
- * interested in.
- */
- Objects(sdbusplus::bus::bus& bus, const std::vector<Interface>& filter);
- Objects(const Objects&) = default;
- Objects& operator=(const Objects&) = default;
- Objects(Objects&&) = delete;
- Objects& operator=(Objects&&) = delete;
- ~Objects() = default;
-
- /** @brief Fetch d-bus service, given a path and an interface. The
- * service can't be cached because mapper returns unique
- * service names.
- *
- * @param[in] path - The Dbus object
- * @param[in] interface - The Dbus interface
- *
- * @return std::string - the dbus service
- */
- Service service(const Path& path, const Interface& interface) const;
-
- /** @brief map of settings objects */
- std::map<Interface, std::vector<Path>> map;
-
- /** @brief The Dbus bus object */
- sdbusplus::bus::bus& bus;
-};
-
-namespace boot
-{
-
-using OneTimeEnabled = bool;
-
-/** @brief Return the one-time boot setting object path if enabled, otherwise
- * the regular boot setting object path.
- *
- * @param[in] objects - const reference to an object of type Objects
- * @param[in] iface - boot setting interface
- *
- * @return A tuple - boot setting object path, a bool indicating whether the
- * returned path corresponds to the one time boot setting.
- */
-std::tuple<Path, OneTimeEnabled> setting(const Objects& objects,
- const Interface& iface);
-
-} // namespace boot
-
-} // namespace settings