On 12/14/2011 06:16 AM, Osier Yang wrote:
An simple example to show to use it:
\#! /usr/bin/python
import os
import sys
import libvirt
disk = "/var/lib/libvirt/images/test.img"
conn = libvirt.open(None)
dom = conn.lookupByName('test')
mem_contents = dom.memoryPeek(0, 128, libvirt.VIR_MEMORY_VIRTUAL);
sys.stdout.write(mem_contents)
That does indeed help review.
</function>
+ <function name='virDomainBlockPeek' file='python'>
+ <info>Read the contents of domain's disk device</info>
+ <arg name='dom' type='virDomainPtr' info='pointer to the
domain'/>
+ <arg name='disk' type='const char *' info='disk
name'/>
+ <arg name='offset' type='unsigned long long' info='offset
within block device'/>
+ <arg name='size' type='size_t' info='size to
read'/>
+ <arg name='flags' type='unsigned int' info='unused, always
passed 0'/>
s/passed/pass/
+
+cleanup:
+ memset(buf, 0, size);
+ free(buf);
Drop the memset(). Since you are free()ing buf anyways, it's a waste of
time to zero the memory before it goes out of scope. (both instances).
ACK with those fixes, plus the ones you pointed out in your commit message.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org