diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 94c823d39da1ebca022c7827f7613da1afc952ee..b2be2d0fb906c58a798594ec1117d56654740255 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1750,7 +1750,6 @@ virDBusGetSystemBus; virDBusHasSystemBus; virDBusMessageDecode; virDBusMessageEncode; -virDBusMessageRead; virDBusMessageUnref; virDBusSetSharedBus; diff --git a/src/util/virdbus.c b/src/util/virdbus.c index 6725e0edb034d40239881091bc44c46b4348fcd7..b0ac8d7055993a6d7480342f2e4681c61d8d8efd 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -1228,9 +1228,23 @@ int virDBusMessageEncode(DBusMessage* msg, } -int virDBusMessageDecode(DBusMessage* msg, - const char *types, - ...) +/** + * virDBusMessageDecode: + * @msg: the reply to decode + * @types: type signature for following return values + * @...: pointers in which to store return values + * + * The @types type signature is the same format as + * that used for the virDBusCallMethod. The difference + * is that each variadic parameter must be a pointer to + * be filled with the values. eg instead of passing an + * 'int', pass an 'int *'. + * + */ +int +virDBusMessageDecode(DBusMessage* msg, + const char *types, + ...) { int ret; va_list args; @@ -1654,32 +1668,6 @@ int virDBusCallMethod(DBusConnection *conn, } -/** - * virDBusMessageRead: - * @msg: the reply to decode - * @types: type signature for following return values - * @...: pointers in which to store return values - * - * The @types type signature is the same format as - * that used for the virDBusCallMethod. The difference - * is that each variadic parameter must be a pointer to - * be filled with the values. eg instead of passing an - * 'int', pass an 'int *'. - * - */ -int virDBusMessageRead(DBusMessage *msg, - const char *types, ...) -{ - va_list args; - int ret; - - va_start(args, types); - ret = virDBusMessageDecodeArgs(msg, types, args); - va_end(args); - - return ret; -} - static int virDBusIsServiceInList(const char *listMethod, const char *name) { DBusConnection *conn; @@ -1854,13 +1842,6 @@ int virDBusCallMethod(DBusConnection *conn ATTRIBUTE_UNUSED, return -1; } -int virDBusMessageRead(DBusMessage *msg ATTRIBUTE_UNUSED, - const char *types ATTRIBUTE_UNUSED, ...) -{ - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("DBus support not compiled into this binary")); - return -1; -} int virDBusMessageEncode(DBusMessage* msg ATTRIBUTE_UNUSED, const char *types ATTRIBUTE_UNUSED, diff --git a/src/util/virdbus.h b/src/util/virdbus.h index 268a42afd4f1db94583638ccdb2b8529f82e122b..c1e5de31abd117175f15928c2d846f3d83cd9789 100644 --- a/src/util/virdbus.h +++ b/src/util/virdbus.h @@ -67,8 +67,8 @@ int virDBusCallMethod(DBusConnection *conn, const char *iface, const char *member, const char *types, ...); -int virDBusMessageRead(DBusMessage *msg, - const char *types, ...); +int virDBusMessageDecode(DBusMessage *msg, + const char *types, ...); void virDBusMessageUnref(DBusMessage *msg); int virDBusIsServiceEnabled(const char *name); diff --git a/src/util/virdbuspriv.h b/src/util/virdbuspriv.h index 4f0140c5207eec91a16195cc4fbad21e77f8d26c..5c0c7f8b6eafe0f62b0e8217b1561d199142ee8f 100644 --- a/src/util/virdbuspriv.h +++ b/src/util/virdbuspriv.h @@ -56,8 +56,4 @@ int virDBusMessageEncode(DBusMessage* msg, const char *types, ...); -int virDBusMessageDecode(DBusMessage* msg, - const char *types, - ...); - #endif /* LIBVIRT_VIRDBUSPRIV_H */ diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c index 5d83c3ea2b940ab3c2825a95b33076cb8ade149b..60b75e7e252f30be343bd563099c801ad0311df5 100644 --- a/src/util/virfirewalld.c +++ b/src/util/virfirewalld.c @@ -102,7 +102,7 @@ virFirewallDGetVersion(unsigned long *version) "version") < 0) goto cleanup; - if (virDBusMessageRead(reply, "v", "s", &versionStr) < 0) + if (virDBusMessageDecode(reply, "v", "s", &versionStr) < 0) goto cleanup; if (virParseVersionString(versionStr, version, false) < 0) { @@ -163,7 +163,7 @@ virFirewallDGetBackend(void) goto cleanup; } - if (virDBusMessageRead(reply, "v", "s", &backendStr) < 0) + if (virDBusMessageDecode(reply, "v", "s", &backendStr) < 0) goto cleanup; VIR_DEBUG("FirewallD backend: %s", backendStr); @@ -216,7 +216,7 @@ virFirewallDGetZones(char ***zones, size_t *nzones) NULL) < 0) goto cleanup; - if (virDBusMessageRead(reply, "a&s", nzones, zones) < 0) + if (virDBusMessageDecode(reply, "a&s", nzones, zones) < 0) goto cleanup; ret = 0; @@ -337,7 +337,7 @@ virFirewallDApplyRule(virFirewallLayer layer, goto cleanup; } } else { - if (virDBusMessageRead(reply, "s", output) < 0) + if (virDBusMessageDecode(reply, "s", output) < 0) goto cleanup; } diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c index 198439cea2915c23874436a7f8b6458a11780346..25eaad2c63117e904651b8f5a1b5c68bcdf5fa67 100644 --- a/src/util/virpolkit.c +++ b/src/util/virpolkit.c @@ -97,12 +97,12 @@ int virPolkitCheckAuth(const char *actionid, "" /* cancellation ID */) < 0) goto cleanup; - if (virDBusMessageRead(reply, - "(bba&{ss})", - &is_authorized, - &is_challenge, - &nretdetails, - &retdetails) < 0) + if (virDBusMessageDecode(reply, + "(bba&{ss})", + &is_authorized, + &is_challenge, + &nretdetails, + &retdetails) < 0) goto cleanup; for (i = 0; i < (nretdetails / 2); i++) { diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index b868f88a59ccc2177ba8e258a924f964f4525131..3f03e3bd63c7d0e6485cf7ab389a9efdac58bfe7 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -182,7 +182,7 @@ virSystemdGetMachineNameByPID(pid_t pid) "u", pid) < 0) goto cleanup; - if (virDBusMessageRead(reply, "o", &object) < 0) + if (virDBusMessageDecode(reply, "o", &object) < 0) goto cleanup; virDBusMessageUnref(reply); @@ -201,7 +201,7 @@ virSystemdGetMachineNameByPID(pid_t pid) "Name") < 0) goto cleanup; - if (virDBusMessageRead(reply, "v", "s", &name) < 0) + if (virDBusMessageDecode(reply, "v", "s", &name) < 0) goto cleanup; VIR_DEBUG("Domain with pid %lld has machine name '%s'", @@ -533,7 +533,7 @@ virSystemdPMSupportTarget(const char *methodName, bool *result) NULL) < 0) return ret; - if ((ret = virDBusMessageRead(message, "s", &response)) < 0) + if ((ret = virDBusMessageDecode(message, "s", &response)) < 0) goto cleanup; *result = STREQ("yes", response) || STREQ("challenge", response); diff --git a/tests/virpolkittest.c b/tests/virpolkittest.c index 25e759d7036a1227c61737f74dae5be703d46306..94a6daae0c169b94ee2b716c3504bfcdad98cfe9 100644 --- a/tests/virpolkittest.c +++ b/tests/virpolkittest.c @@ -72,18 +72,18 @@ VIR_MOCK_WRAP_RET_ARGS(dbus_connection_send_with_reply_and_block, int is_authorized = 1; int is_challenge = 0; - if (virDBusMessageRead(message, - "(sa{sv})sa&{ss}us", - &type, - 3, - &pidkey, "u", &pidval, - &timekey, "t", &timeval, - &uidkey, "i", &uidval, - &actionid, - &detailslen, - &details, - &allowInteraction, - &cancellationId) < 0) + if (virDBusMessageDecode(message, + "(sa{sv})sa&{ss}us", + &type, + 3, + &pidkey, "u", &pidval, + &timekey, "t", &timeval, + &uidkey, "i", &uidval, + &actionid, + &detailslen, + &details, + &allowInteraction, + &cancellationId) < 0) goto error; if (STREQ(actionid, "org.libvirt.test.success")) {