[libvirt] [PATCH 1/2] Introduce virDBusCallMethod & virDBusMessageRead methods

Eric Blake eblake at redhat.com
Tue Jul 23 23:02:54 UTC 2013


On 07/18/2013 07:27 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Doing DBus method calls using libdbus.so is tedious in the
> extreme. systemd developers came up with a nice high level
> API for DBus method calls (sd_bus_call_method). While
> systemd doesn't use libdbus.so, their API design can easily
> be ported to libdbus.so.
> 
> This patch thus introduces methods virDBusCallMethod &
> virDBusMessageRead, which are based on the code used for
> sd_bus_call_method and sd_bus_message_read. This code in
> systemd is under the LGPLv2+, so we're license compatible.
> 
> This code is probably pretty unintelligible unless you are
> familiar with the DBus type system. So I added some API
> docs trying to explain how to use them, as well as test
> cases to validate that I didn't screw up the adaptation
> from the original systemd code.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---

> +static const char virDBusBasicTypes[] = {
> +    DBUS_TYPE_BYTE,
> +    DBUS_TYPE_BOOLEAN,
> +    DBUS_TYPE_INT16,
> +    DBUS_TYPE_UINT16,
> +    DBUS_TYPE_INT32,
> +    DBUS_TYPE_UINT32,
> +    DBUS_TYPE_INT64,
> +    DBUS_TYPE_UINT64,
> +    DBUS_TYPE_DOUBLE,
> +    DBUS_TYPE_STRING,
> +    DBUS_TYPE_OBJECT_PATH,
> +    DBUS_TYPE_SIGNATURE,
> +    DBUS_TYPE_UNIX_FD
> +};

This fails to build on RHEL 6.4:

  CC     libvirt_util_la-virdbus.lo
util/virdbus.c:242: error: 'DBUS_TYPE_UNIX_FD' undeclared here (not in a
function)
cc1: warnings being treated as errors


DBUS_TYPE_UNIX_FD was added sometime after dbus-devel-1.2.24 and before
1.6.12; we'll have to make the code conditional and error out if a
client tries to pass an fd when using an older version of dbus.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130723/41538019/attachment-0001.sig>


More information about the libvir-list mailing list