|
|
7100e8 |
commit 04d86af8d57dd8c16283ea6acc6d6798053cf2a0
|
|
|
7100e8 |
Author: Andrew Beekhof <andrew@beekhof.net>
|
|
|
7100e8 |
Date: Wed Feb 5 10:56:51 2014 +1100
|
|
|
7100e8 |
|
|
|
7100e8 |
Refactor: dbus: Use native function for adding arguments to messages
|
|
|
7100e8 |
|
|
|
7100e8 |
(cherry picked from commit bab144c83e90785c7df01423d3b239cbd4a2cd55)
|
|
|
7100e8 |
|
|
|
7100e8 |
diff --git a/lib/services/dbus.c b/lib/services/dbus.c
|
|
|
7100e8 |
index 66a98a0..b424c0b 100644
|
|
|
7100e8 |
--- a/lib/services/dbus.c
|
|
|
7100e8 |
+++ b/lib/services/dbus.c
|
|
|
7100e8 |
@@ -33,19 +33,6 @@ void pcmk_dbus_disconnect(DBusConnection *connection)
|
|
|
7100e8 |
{
|
|
|
7100e8 |
}
|
|
|
7100e8 |
|
|
|
7100e8 |
-bool pcmk_dbus_append_arg(DBusMessage *msg, int dtype, const void *value)
|
|
|
7100e8 |
-{
|
|
|
7100e8 |
- DBusMessageIter args;
|
|
|
7100e8 |
-
|
|
|
7100e8 |
- dbus_message_iter_init_append(msg, &args);
|
|
|
7100e8 |
- if (!dbus_message_iter_append_basic(&args, dtype, value)) {
|
|
|
7100e8 |
- crm_err("dbus_message_iter_append_basic(%c) failed", dtype);
|
|
|
7100e8 |
- return FALSE;
|
|
|
7100e8 |
- }
|
|
|
7100e8 |
-
|
|
|
7100e8 |
- return TRUE;
|
|
|
7100e8 |
-}
|
|
|
7100e8 |
-
|
|
|
7100e8 |
bool
|
|
|
7100e8 |
pcmk_dbus_find_error(const char *method, DBusPendingCall* pending, DBusMessage *reply, DBusError *ret)
|
|
|
7100e8 |
{
|
|
|
7100e8 |
@@ -235,7 +222,7 @@ pcmk_dbus_get_property(
|
|
|
7100e8 |
return NULL;
|
|
|
7100e8 |
}
|
|
|
7100e8 |
|
|
|
7100e8 |
- pcmk_dbus_append_arg(msg, DBUS_TYPE_STRING, &iface);
|
|
|
7100e8 |
+ CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &iface, DBUS_TYPE_INVALID));
|
|
|
7100e8 |
|
|
|
7100e8 |
reply = pcmk_dbus_send_recv(msg, connection, &error);
|
|
|
7100e8 |
dbus_message_unref(msg);
|
|
|
7100e8 |
diff --git a/lib/services/pcmk-dbus.h b/lib/services/pcmk-dbus.h
|
|
|
7100e8 |
index c8d2234..3b7a598 100644
|
|
|
7100e8 |
--- a/lib/services/pcmk-dbus.h
|
|
|
7100e8 |
+++ b/lib/services/pcmk-dbus.h
|
|
|
7100e8 |
@@ -5,7 +5,6 @@ void pcmk_dbus_disconnect(DBusConnection *connection);
|
|
|
7100e8 |
bool pcmk_dbus_send(DBusMessage *msg, DBusConnection *connection,
|
|
|
7100e8 |
void(*done)(DBusPendingCall *pending, void *user_data), void *user_data);
|
|
|
7100e8 |
DBusMessage *pcmk_dbus_send_recv(DBusMessage *msg, DBusConnection *connection, DBusError *error);
|
|
|
7100e8 |
-bool pcmk_dbus_append_arg(DBusMessage *msg, int dtype, const void *value);
|
|
|
7100e8 |
bool pcmk_dbus_type_check(DBusMessage *msg, DBusMessageIter *field, int expected, const char *function, int line);
|
|
|
7100e8 |
char *pcmk_dbus_get_property(DBusConnection *connection, const char *target, const char *obj, const gchar * iface, const char *name);
|
|
|
7100e8 |
|
|
|
7100e8 |
diff --git a/lib/services/systemd.c b/lib/services/systemd.c
|
|
|
7100e8 |
index b461c5f..374a03e 100644
|
|
|
7100e8 |
--- a/lib/services/systemd.c
|
|
|
7100e8 |
+++ b/lib/services/systemd.c
|
|
|
7100e8 |
@@ -146,7 +146,7 @@ systemd_unit_by_name(const gchar * arg_name, gchar ** out_unit)
|
|
|
7100e8 |
msg = systemd_new_method(BUS_NAME".Manager", method);
|
|
|
7100e8 |
CRM_ASSERT(msg != NULL);
|
|
|
7100e8 |
|
|
|
7100e8 |
- pcmk_dbus_append_arg(msg, DBUS_TYPE_STRING, &name);
|
|
|
7100e8 |
+ CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID));
|
|
|
7100e8 |
|
|
|
7100e8 |
dbus_error_init(&error);
|
|
|
7100e8 |
reply = pcmk_dbus_send_recv(msg, systemd_proxy, &error);
|
|
|
7100e8 |
@@ -477,8 +477,8 @@ systemd_unit_exec(svc_action_t * op, gboolean synchronous)
|
|
|
7100e8 |
CRM_ASSERT(msg != NULL);
|
|
|
7100e8 |
|
|
|
7100e8 |
/* (ss) */
|
|
|
7100e8 |
- pcmk_dbus_append_arg(msg, DBUS_TYPE_STRING, &name);
|
|
|
7100e8 |
- pcmk_dbus_append_arg(msg, DBUS_TYPE_STRING, &replace_s);
|
|
|
7100e8 |
+ CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID));
|
|
|
7100e8 |
+ CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &replace_s, DBUS_TYPE_INVALID));
|
|
|
7100e8 |
|
|
|
7100e8 |
if (synchronous == FALSE) {
|
|
|
7100e8 |
free(unit);
|