Re: [dbus PATCH v2 4/9] Implement NodeGetMemoryParameters method in Connect Interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 02, 2018 at 12:34:41PM +0200, Katerina Koukiou wrote:
> Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
> ---
>  data/org.libvirt.Connect.xml |  6 ++++++
>  src/connect.c                | 38 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+)
> 
> diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
> index 6b6758f..c62d107 100644
> --- a/data/org.libvirt.Connect.xml
> +++ b/data/org.libvirt.Connect.xml
> @@ -183,6 +183,12 @@
>          value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetInfo"/>
>        <arg name="info" type="(stuuuuuu)" direction="out"/>
>      </method>
> +    <method name="NodeGetMemoryParameters">
> +      <annotation name="org.gtk.GDBus.DocString"
> +        value="See https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetMemoryParameters"/>
> +      <arg name="flags" type="u" direction="in"/>
> +      <arg name="memoryParameters" type="a{sv}" direction="out"/>
> +    </method>
>      <signal name="DomainEvent">
>        <annotation name="org.gtk.GDBus.DocString"
>          value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventCallback"/>
> diff --git a/src/connect.c b/src/connect.c
> index 367d5ae..f2c6d45 100644
> --- a/src/connect.c
> +++ b/src/connect.c
> @@ -929,6 +929,43 @@ virtDBusConnectNodeGetInfo(GVariant *inArgs G_GNUC_UNUSED,
>                               info.cores, info.threads);
>  }
>  
> +static void
> +virtDBusConnectNodeGetMemoryParameters(GVariant *inArgs,
> +                                       GUnixFDList *inFDs G_GNUC_UNUSED,
> +                                       const gchar *objectPath G_GNUC_UNUSED,
> +                                       gpointer userData,
> +                                       GVariant **outArgs,
> +                                       GUnixFDList **outFDs G_GNUC_UNUSED,
> +                                       GError **error)
> +{
> +    virtDBusConnect *connect = userData;
> +    g_auto(virtDBusUtilTypedParams) params = { 0 };
> +    guint flags;
> +    gint ret;
> +    GVariant *grecords;
> +
> +    g_variant_get(inArgs, "(u)", &flags);
> +
> +    if (!virtDBusConnectOpen(connect, error))
> +        return;
> +
> +    ret = virNodeGetMemoryParameters(connect->connection, NULL,
> +                                     &params.nparams, flags);
> +    if (ret < 0)
> +        return virtDBusUtilSetLastVirtError(error);

I would put an empty line here to logically separate the code.

> +    if (params.nparams != 0) {
> +        params.params = g_new0(virTypedParameter, params.nparams);
> +        if (virNodeGetMemoryParameters(connect->connection, params.params,
> +                                       &params.nparams, flags) < 0) {
> +            return virtDBusUtilSetLastVirtError(error);
> +        }
> +    }

Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux