[libvirt] [PATCH 02/10] virdbus: Add virDBusGetSessionBus helper
Eric Blake
eblake at redhat.com
Tue Nov 27 18:48:51 UTC 2012
----- Original Message -----
> From: Alexander Larsson <alexl at redhat.com>
>
> This splits out some common code from virDBusGetSystemBus and
> uses it to implement a new virDBusGetSessionBus helper.
> ---
> src/libvirt_private.syms | 1 +
> src/util/virdbus.c | 84
> ++++++++++++++++++++++++++++++++++++------------
> src/util/virdbus.h | 1 +
> 3 files changed, 66 insertions(+), 20 deletions(-)
>
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 63e187a..8d649bf 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1336,6 +1336,7 @@ virConsoleOpen;
>
> # virdbus.h
> virDBusGetSystemBus;
> +virDBusGetSessionBus;
Sorting (although I see 4/10 touches this again, and it doesn't
affect bisection, so I won't oppose this going in as-is)
> +++ b/src/util/virdbus.c
> @@ -32,40 +32,49 @@
> #ifdef HAVE_DBUS
>
> static DBusConnection *systembus = NULL;
> -static virOnceControl once = VIR_ONCE_CONTROL_INITIALIZER;
> -static DBusError dbuserr;
> +static DBusConnection *sessionbus = NULL;
Explicit initialization to NULL is not required for static variables,
but neither does it hurt, and it was just copy-and-paste (gcc is smart
enough to stick explicit 0 initialization into .bss).
>
> -static void virDBusSystemBusInit(void)
> +static DBusConnection *virDBusBusInit(DBusBusType type, DBusError
> *dbuserr)
Long line; should this be:
static DBusConnection*
virDBusBusInit(DBusBusType type, DBusError *dbuserr)
> @@ -74,7 +83,7 @@ DBusConnection *virDBusGetSystemBus(void)
> if (!systembus) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
> _("Unable to get DBus system bus connection:
> %s"),
> - dbuserr.message ? dbuserr.message : "watch
> setup failed");
> + systemdbuserr.message ? systemdbuserr.message
> : "watch setup failed");
Worth wrapping this to avoid long lines?
ACK
More information about the libvir-list
mailing list