[libvirt] [RFC PATCH 3/8] Snapshot API framework.

Chris Lalancette clalance at redhat.com
Fri Apr 2 14:30:19 UTC 2010


On 04/02/2010 09:23 AM, Matthias Bolte wrote:
> 2010/4/2 Chris Lalancette <clalance at redhat.com>:
>> Signed-off-by: Chris Lalancette <clalance at redhat.com>
>> ---
>>  daemon/remote.c                     |  311 ++++++++++++++++++++++++
>>  daemon/remote_dispatch_args.h       |    9 +
>>  daemon/remote_dispatch_prototypes.h |   72 ++++++
>>  daemon/remote_dispatch_ret.h        |    7 +
>>  daemon/remote_dispatch_table.h      |   45 ++++
>>  include/libvirt/libvirt.h.in        |   61 +++++
>>  include/libvirt/virterror.h         |    5 +-
>>  src/datatypes.c                     |  122 ++++++++++
>>  src/datatypes.h                     |   25 ++
>>  src/driver.h                        |   47 ++++
>>  src/esx/esx_driver.c                |    9 +
>>  src/libvirt.c                       |  448 +++++++++++++++++++++++++++++++++++
>>  src/libvirt_private.syms            |    1 +
>>  src/libvirt_public.syms             |   10 +
>>  src/lxc/lxc_driver.c                |    9 +
>>  src/opennebula/one_driver.c         |    9 +
>>  src/openvz/openvz_driver.c          |    9 +
>>  src/phyp/phyp_driver.c              |    9 +
>>  src/qemu/qemu_driver.c              |    9 +
>>  src/remote/remote_driver.c          |  309 ++++++++++++++++++++++++
>>  src/remote/remote_protocol.c        |  181 ++++++++++++++
>>  src/remote/remote_protocol.h        |  145 +++++++++++
>>  src/remote/remote_protocol.x        |   97 ++++++++-
>>  src/test/test_driver.c              |    9 +
>>  src/uml/uml_driver.c                |    9 +
>>  src/util/virterror.c                |   15 ++
>>  src/vbox/vbox_tmpl.c                |    9 +
>>  src/xen/xen_driver.c                |    9 +
>>  src/xenapi/xenapi_driver.c          |    9 +
>>  29 files changed, 2007 insertions(+), 2 deletions(-)
>>
> 
> 
>> diff --git a/src/datatypes.h b/src/datatypes.h
>> index 4663c9c..bbeb7cf 100644
>> --- a/src/datatypes.h
>> +++ b/src/datatypes.h
>> @@ -130,6 +130,15 @@
>>  # define VIR_IS_NWFILTER(obj)                  ((obj) && (obj)->magic==VIR_NWFILTER_MAGIC)
>>  # define VIR_IS_CONNECTED_NWFILTER(obj)                (VIR_IS_NWFILTER(obj) && VIR_IS_CONNECT((obj)->conn))
>>
>> +/**
>> + * VIR_SNAPSHOT_MAGIC:
>> + *
>> + * magic value used to protect the API when pointers to snapshot structures
>> + * are passed down by the users.
>> + */
>> +# define VIR_SNAPSHOT_MAGIC                0x6666DEAD
>> +# define VIR_IS_SNAPSHOT(obj)              ((obj) && (obj)->magic==VIR_SNAPSHOT_MAGIC)
>> +# define VIR_IS_DOMAIN_SNAPSHOT(obj)    (VIR_IS_SNAPSHOT(obj) && VIR_IS_DOMAIN((obj)->domain))
> 
> Why do we need to distinguish between a snapshot and a domain snapshot?

To be perfectly honest, I don't think we do.  I was just following the template
from the rest of the macros in this file; this could easily enough be written
as:

# define VIR_IS_DOMAIN_SNAPSHOT(obj) ((obj) && (obj)->magic==VIR_SNAPSHOT_MAGIC) && VIR_IS_DOMAIN(obj)->domain)

I don't really care either way.

-- 
Chris Lalancette




More information about the libvir-list mailing list