summaryrefslogtreecommitdiffstats
path: root/storageaddsel.cpp
diff options
context:
space:
mode:
authorSergey Solomin <sergey.solomin@us.ibm.com>2016-08-23 09:07:28 -0500
committerSergey Solomin <sergey.solomin@us.ibm.com>2016-08-25 13:37:57 -0500
commiteb9b814403895d6435e04f02a9ff6c2b1b02cf54 (patch)
tree4a1713845844f874799a1b188db209adeaa3e085 /storageaddsel.cpp
parentbc40c178bb0b345ed1edf553b94369330003af34 (diff)
downloadphosphor-host-ipmid-eb9b814403895d6435e04f02a9ff6c2b1b02cf54.tar.gz
phosphor-host-ipmid-eb9b814403895d6435e04f02a9ff6c2b1b02cf54.zip
Hard-coded service name replaced with call to ObjectMapper
In the openbmc code, the dbus service name is hardcoded. The ObjectMapper provides a way to find out the service name by issuing a GetObject method call to the ObjectMapper. That functionality is implemented in mapper.c The output of the call to the mapper is a service name. Resolves openbmc/openbmc#319. Change-Id: I724a31ede6bdf3ae4b361e730857b1f2696a8966 Signed-off-by: Sergey Solomin <sergey.solomin@us.ibm.com>
Diffstat (limited to 'storageaddsel.cpp')
-rw-r--r--storageaddsel.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/storageaddsel.cpp b/storageaddsel.cpp
index 3343772..9d15a49 100644
--- a/storageaddsel.cpp
+++ b/storageaddsel.cpp
@@ -7,7 +7,7 @@
#include <vector>
#include <memory>
#include <systemd/sd-bus.h>
-
+#include <mapper.h>
#include "ipmid.H"
#include "storagehandler.h"
#include "sensorhandler.h"
@@ -179,12 +179,18 @@ int send_esel_to_dbus(const char *desc, const char *sev, const char *details, ui
sd_bus_message *reply = NULL, *m=NULL;
uint16_t x;
int r;
+ const char *object_name = "/org/openbmc/records/events";
+ char *bus_name = NULL;
mbus = ipmid_get_sd_bus_connection();
-
+ r = mapper_get_service(mbus, object_name, &bus_name);
+ if (r < 0) {
+ fprintf(stderr, "Failed to get connection, return value: %s.\n", strerror(-r));
+ goto finish;
+ }
r = sd_bus_message_new_method_call(mbus,&m,
- "org.openbmc.records.events",
- "/org/openbmc/records/events",
+ bus_name,
+ object_name,
"org.openbmc.recordlog",
"acceptHostMessage");
if (r < 0) {
@@ -218,6 +224,7 @@ finish:
sd_bus_error_free(&error);
m = sd_bus_message_unref(m);
reply = sd_bus_message_unref(reply);
+ free (bus_name);
return r;
}
OpenPOWER on IntegriCloud