Re: [PATCHv2 7/7] snapshot: implement snapshot children listing in qemu

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

 



On 10/09/2011 09:29 PM, Daniel Veillard wrote:
On Fri, Sep 30, 2011 at 05:09:29PM -0600, Eric Blake wrote:
Not too hard to wire up.  The trickiest part is realizing that
listing children of a snapshot cannot use SNAPSHOT_LIST_ROOTS,
and that we overloaded that bit to also mean SNAPSHOT_LIST_DESCENDANTS;
we use that bit to decide which iteration to use, but don't want
the existing counting/listing functions to see that bit.


+static int
+qemuDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
+                              unsigned int flags)
+{
+    struct qemud_driver *driver = snapshot->domain->conn->privateData;


   ACK,

I've now pushed 1-7.

I would tend to be a bit more defensive myself byt not dereferencing 3
layers of pointer as the first instructions in the function, but
if you're confident the structures can't be missing :-)

Yes, src/libvirt.c already validated that snapshot, snapshot->domain, and snapshot->domain->conn are all correct and non-NULL. We do this same sort of 3-level validation in several other APIs, relying on libvirt.c to have filtered out invalid objects in advance of calling the hypervisor callback.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
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]