On 07/18/2013 07:27 AM, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > 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@xxxxxxxxxx> > --- > +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
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list