[libvirt] [PATCHv2 1/3] virdbus: Add virDBusHasSystemBus()

Peter Krempa pkrempa at redhat.com
Mon Aug 19 10:50:58 UTC 2013


On 08/19/13 12:45, Daniel P. Berrange wrote:
> On Mon, Aug 19, 2013 at 12:32:05PM +0200, Peter Krempa wrote:
>> Some systems may not use DBus in their system. Add a method to check if
>> the system bus is available that doesn't print error messages so that
>> code can later check for this condition and use an alternative approach.
>> ---
>>  src/libvirt_private.syms |  1 +
>>  src/util/virdbus.c       | 34 +++++++++++++++++++++++++++++++---
>>  src/util/virdbus.h       |  1 +
>>  3 files changed, 33 insertions(+), 3 deletions(-)

....

>>
>>  DBusConnection *virDBusGetSystemBus(void);
>> +DBusConnection *virDBusHasSystemBus(void);
> 
> This should be a returning a 'bool' IMHO. eg usage would be 
> 
> 
>    if (virDBusHasSystemBus()) {
>       DBusConnection conn = virDBusGetSystemBus()
>       ....dbus code path...
>    } else {
>       ... non-dbus code path...
>    }

That was my initial implementation but it resulted in a few more lines
of code. I'll repost with that changed.

Peter


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


More information about the libvir-list mailing list