[libvirt] [PATCH] python: Expose memoryPeek to Python binding

Eric Blake eblake at redhat.com
Tue Dec 13 18:38:42 UTC 2011


On 12/13/2011 06:43 AM, Osier Yang wrote:
> ---
>  python/libvirt-override-api.xml |    8 ++++++++
>  python/libvirt-override.c       |   33 +++++++++++++++++++++++++++++++++
>  2 files changed, 41 insertions(+), 0 deletions(-)
> 

> +    if ((buf = malloc(size)) == NULL)
> +        return VIR_PY_NONE;
> +
> +    LIBVIRT_BEGIN_ALLOW_THREADS;
> +    c_retval = virDomainMemoryPeek(domain, start, size, buf, flags);
> +    LIBVIRT_END_ALLOW_THREADS;
> +
> +    if (c_retval < 0)
> +        return VIR_PY_NONE;
> +
> +    py_retval = libvirt_charPtrWrap(buf);
> +    return py_retval;

Same problems as for blockPeek.  I don't know if
PyString_FromStringAndSize will do what you want, but that's my guess,
based on its use for VIR_UUID_BUFLEN arrays.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111213/63ebd9c0/attachment-0001.sig>


More information about the libvir-list mailing list