[libvirt] [dbus PATCH 01/15] Introduce Interface Interface

Pavel Hrdina phrdina at redhat.com
Tue Jul 10 08:15:01 UTC 2018


On Fri, Jul 06, 2018 at 05:36:41PM -0400, Anya Harter wrote:
> Signed-off-by: Anya Harter <aharter at redhat.com>
> ---
>  data/Makefile.am               |  1 +
>  data/org.libvirt.Interface.xml |  7 +++
>  src/Makefile.am                |  2 +
>  src/connect.c                  |  6 +++
>  src/connect.h                  |  1 +
>  src/interface.c                | 86 ++++++++++++++++++++++++++++++++++
>  src/interface.h                |  9 ++++
>  src/util.c                     | 35 ++++++++++++++
>  src/util.h                     | 15 ++++++
>  9 files changed, 162 insertions(+)
>  create mode 100644 data/org.libvirt.Interface.xml
>  create mode 100644 src/interface.c
>  create mode 100644 src/interface.h

[...]

> diff --git a/src/interface.c b/src/interface.c
> new file mode 100644
> index 0000000..6dbc702
> --- /dev/null
> +++ b/src/interface.c
> @@ -0,0 +1,86 @@
> +#include "interface.h"
> +#include "util.h"
> +
> +#include <libvirt/libvirt.h>
> +
> +static virInterfacePtr
> +virtDBusInterfaceGetVirInterface(virtDBusConnect *connect,
> +                                 const gchar *objectPath,
> +                                 GError **error)
> +{

This function needs to be introduced in patch that uses it.
It's a static function and compilation fails for this commit.

Every commit should be able to compile in order not to break
"git bisect".  You can easily try to do that by calling:

    git rebase -x "make && make check" origin/master

This will rebase current branch on top of origin master and call
"make && make check" for every commit that is applied on top of master.
 
    git rebase -i -x "make && make check" origin/master

In interactive mode you can review what is going to happen.

> +    virInterfacePtr interface;
> +
> +    if (virtDBusConnectOpen(connect, error) < 0)
> +        return NULL;
> +
> +    interface = virtDBusUtilVirInterfaceFromBusPath(connect->connection,
> +                                                    objectPath,
> +                                                    connect->interfacePath);
> +    if (!interface) {
> +        virtDBusUtilSetLastVirtError(error);
> +        return NULL;
> +    }
> +
> +    return interface;
> +}
> +
> +static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
> +    { 0 }
> +};
> +
> +static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
> +    { 0 }
> +};
> +
> +static gchar **
> +virtDBusInterfaceEnumerate(gpointer userData)
> +{
> +    virtDBusConnect *connect = userData;
> +    g_autoptr(virInterfacePtr) interfaces = NULL;
> +    gint num = 0;
> +    gchar **ret = NULL;
> +
> +    if (!virtDBusConnectOpen(connect, NULL))
> +        return NULL;
> +
> +    num = virConnectListAllInterfaces(connect->connection, &interfaces, 0);
> +    if (num < 0)
> +        return NULL;
> +
> +    if (num == 0)
> +        return NULL;
> +
> +    ret = g_new0(gchar *, num + 1);
> +
> +    for (gint i = 0; i < num; i++) {
> +        ret[i] = virtDBusUtilBusPathForVirInterface(interfaces[i],
> +                                                    connect->interfacePath);
> +    }
> +
> +    return ret;
> +}
> +
> +static GDBusInterfaceInfo *interfaceInfo;
> +
> +void
> +virtDBusInterfaceRegister(virtDBusConnect *connect,
> +                         GError **error)

Indentation is off.

Otherwise it looks good.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180710/89a08b26/attachment-0001.sig>


More information about the libvir-list mailing list