Re: [dbus PATCH 05/25] Implement MemoryPeek method for Domain Interface

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

 



On Tue, Apr 17, 2018 at 02:04:24PM +0200, Katerina Koukiou wrote:
> Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
> ---
>  data/org.libvirt.Domain.xml |  8 ++++++++
>  src/domain.c                | 38 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 46 insertions(+)
> 
> diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
> index 85e2cf6..bd30ad4 100644
> --- a/data/org.libvirt.Domain.xml
> +++ b/data/org.libvirt.Domain.xml
> @@ -148,6 +148,14 @@
>          value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSaveRemove"/>
>        <arg name="flags" type="u" direction="in"/>
>      </method>
> +    <method name="MemoryPeek">
> +      <annotation name="org.gtk.GDBus.DocString"
> +        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryPeek"/>
> +      <arg name="offset" type="t" direction="in"/>
> +      <arg name="size" type="u" direction="in"/>

Same as for the previous one, "t" type and gsize in the code.

> +      <arg name="flags" type="u" direction="in"/>
> +      <arg name="buffer" type="ay" direction="out"/>
> +    </method>
>      <method name="MemoryStats">
>        <annotation name="org.gtk.GDBus.DocString"
>          value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats"/>
> diff --git a/src/domain.c b/src/domain.c
> index c02e289..01f120d 100644
> --- a/src/domain.c
> +++ b/src/domain.c
> @@ -859,6 +859,43 @@ virtDBusDomainManagedSaveRemove(GVariant *inArgs,
>          virtDBusUtilSetLastVirtError(error);
>  }
>  
> +static void
> +virtDBusDomainMemoryPeek(GVariant *inArgs,
> +                         GUnixFDList *inFDs G_GNUC_UNUSED,
> +                         const gchar *objectPath,
> +                         gpointer userData,
> +                         GVariant **outArgs,
> +                         GUnixFDList **outFDs G_GNUC_UNUSED,
> +                         GError **error)
> +{
> +    virtDBusConnect *connect = userData;
> +    g_autoptr(virDomain) domain = NULL;
> +    gulong offset;
> +    guint size;
> +    guint flags;
> +    g_autofree guchar *buffer = NULL;
> +    GVariantBuilder *builder;
> +    GVariant *res;
> +
> +    g_variant_get(inArgs, "(tuu)", &offset, &size, &flags);
> +
> +    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
> +    if (!domain)
> +        return;
> +
> +    buffer = g_new0(guchar, size);
> +    if (virDomainMemoryPeek(domain, offset, size, buffer, flags) < 0)
> +        virtDBusUtilSetLastVirtError(error);

Missing return in case of 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