On Tue, Apr 17, 2018 at 02:04:23PM +0200, Katerina Koukiou wrote: > Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> > --- > data/org.libvirt.Domain.xml | 9 +++++++++ > src/domain.c | 39 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 48 insertions(+) > > diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml > index 48b8a95..85e2cf6 100644 > --- a/data/org.libvirt.Domain.xml > +++ b/data/org.libvirt.Domain.xml > @@ -54,6 +54,15 @@ > <arg name="xml" type="s" direction="in"/> > <arg name="flags" type="u" direction="in"/> > </method> > + <method name="BlockPeek"> > + <annotation name="org.gtk.GDBus.DocString" > + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/> > + <arg name="disk" type="s" direction="in"/> > + <arg name="offset" type="t" direction="in"/> > + <arg name="size" type="u" direction="in"/> I agree with Jano that this should be "t" type and therefore gsize in the code. > + <arg name="flags" type="u" direction="in"/> > + <arg name="buffer" type="ay" direction="out"/> > + </method> > <method name="Create"> > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/> > diff --git a/src/domain.c b/src/domain.c > index 9197755..c02e289 100644 > --- a/src/domain.c > +++ b/src/domain.c > @@ -383,6 +383,44 @@ virtDBusDomainAttachDevice(GVariant *inArgs, > virtDBusUtilSetLastVirtError(error); > } > > +static void > +virtDBusDomainBlockPeek(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; > + const gchar *disk; > + gulong offset; > + guint size; > + guint flags; > + g_autofree guchar *buffer = NULL; > + GVariantBuilder *builder; > + GVariant *res; > + > + g_variant_get(inArgs, "(&stuu)", &disk, &offset, &size, &flags); > + > + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > + if (!domain) > + return; > + > + buffer = g_new0(guchar, size); > + if (virDomainBlockPeek(domain, disk, offset, size, buffer, flags) < 0) > + virtDBusUtilSetLastVirtError(error); We need to return from the function if error is set. 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