summaryrefslogtreecommitdiffstats
path: root/ipmid-new.cpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2019-03-01 16:52:25 -0800
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-03-19 12:48:50 -0700
commit20ff333db29f0d8a46016be3517d11bfb553fc93 (patch)
treecd3b0f53b0e51b773605bed0cb1106a8afef2441 /ipmid-new.cpp
parentbfe55a1f7ca6388662cf9613d08ebb5266cd82f8 (diff)
downloadphosphor-host-ipmid-20ff333db29f0d8a46016be3517d11bfb553fc93.tar.gz
phosphor-host-ipmid-20ff333db29f0d8a46016be3517d11bfb553fc93.zip
Change linkage of ipmid_get_sdbus_plus_handler() to libipmid.so
ipmid_get_sdbus_plus_handler() was re-added to be a part of systemintfcmds where it was used. This moves it to libipmid.so because that is where symbols used by both ipmid and the providers should be. Because ipmid_get_sdbus_plus_handler() relies on the io service and the main sdbus::asio::connection is also right there, this moves those symbols to libipmid as well to keep coherent. Change-Id: Ib125a0c217c8bcf47a8a4bd0c557eb69e928245b Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'ipmid-new.cpp')
-rw-r--r--ipmid-new.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index b7c6205..bf7795c 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -458,18 +458,6 @@ std::forward_list<IpmiProvider> loadProviders(const fs::path& ipmiLibsPath)
} // namespace ipmi
-static std::shared_ptr<boost::asio::io_service> io;
-std::shared_ptr<boost::asio::io_service> getIoService()
-{
- return io;
-}
-
-static std::shared_ptr<sdbusplus::asio::connection> sdbusp;
-std::shared_ptr<sdbusplus::asio::connection> getSdBus()
-{
- return sdbusp;
-}
-
#ifdef ALLOW_DEPRECATED_API
/* legacy registration */
void ipmi_register_callback(ipmi_netfn_t netFn, ipmi_cmd_t cmd,
@@ -559,9 +547,10 @@ void handleLegacyIpmiCommand(sdbusplus::message::message& m)
dest = m.get_sender();
path = m.get_path();
- sdbusp->async_method_call([](boost::system::error_code ec) {}, dest, path,
- DBUS_INTF, "sendMessage", seq, netFn, lun, cmd,
- response->cc, response->payload.raw);
+ getSdBus()->async_method_call([](boost::system::error_code ec) {}, dest,
+ path, DBUS_INTF, "sendMessage", seq, netFn,
+ lun, cmd, response->cc,
+ response->payload.raw);
}
#endif /* ALLOW_DEPRECATED_API */
@@ -579,10 +568,16 @@ std::unique_ptr<phosphor::host::command::Manager>& ipmid_get_host_cmd_manager()
return cmdManager;
}
+// These are symbols that are present in libipmid, but not expected
+// to be used except here (or maybe a unit test), so declare them here
+extern void setIoContext(std::shared_ptr<boost::asio::io_context>& newIo);
+extern void setSdBus(std::shared_ptr<sdbusplus::asio::connection>& newBus);
+
int main(int argc, char* argv[])
{
// Connect to system bus
- io = std::make_shared<boost::asio::io_service>();
+ auto io = std::make_shared<boost::asio::io_context>();
+ setIoContext(io);
if (argc > 1 && std::string(argv[1]) == "-session")
{
sd_bus_default_user(&bus);
@@ -591,7 +586,8 @@ int main(int argc, char* argv[])
{
sd_bus_default_system(&bus);
}
- sdbusp = std::make_shared<sdbusplus::asio::connection>(*io, bus);
+ auto sdbusp = std::make_shared<sdbusplus::asio::connection>(*io, bus);
+ setSdBus(sdbusp);
sdbusp->request_name("xyz.openbmc_project.Ipmi.Host");
// TODO: Hack to keep the sdEvents running.... Not sure why the sd_event
OpenPOWER on IntegriCloud