main: now seeks out shared library handlers are load-time
phosphor-ipmi-blobs now detects blob handlers compiled into shared
libraries on the BMC and loads them at start-up when it's loaded by
phosphor-host-ipmid.
Change-Id: Ib1b6b8f75aa544a263d37f71e133a9a188704de3
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/main.cpp b/main.cpp
index e0828db..f897fda 100644
--- a/main.cpp
+++ b/main.cpp
@@ -18,6 +18,7 @@
#include "ipmi.hpp"
#include "process.hpp"
+#include "utils.hpp"
#include <host-ipmid/ipmid-api.h>
@@ -26,10 +27,6 @@
#include <host-ipmid/oemrouter.hpp>
#include <memory>
-#if ENABLE_EXAMPLE
-#include "example/example.hpp"
-#endif
-
/* TODO: Swap out once https://gerrit.openbmc-project.xyz/12743 is merged */
namespace oem
{
@@ -63,6 +60,9 @@
dataLen);
}
+/* TODO: this should come from the makefile or recipe... */
+constexpr auto expectedHandlerPath = "/usr/lib/blobs-ipmid";
+
void setupBlobGlobalHandler() __attribute__((constructor));
void setupBlobGlobalHandler()
@@ -75,9 +75,7 @@
oemRouter->registerHandler(oem::obmcOemNumber, oem::blobTransferCmd,
handleBlobCommand);
-#if ENABLE_EXAMPLE
- BlobManager* manager = getBlobManager();
- manager->registerHandler(std::move(std::make_unique<ExampleBlobHandler>()));
-#endif
+ /* Install handlers. */
+ loadLibraries(expectedHandlerPath);
}
} // namespace blobs