[libvirt] [PATCH 1/2] snapshot: new APIs for inspecting snapshot object

Eric Blake eblake at redhat.com
Thu Sep 8 12:29:46 UTC 2011


On 09/08/2011 01:21 PM, Eric Blake wrote:
> These functions access internals of the opaque object, and do
> not need any rpc counterpart.  It could be argued that we should
> have provided these when snapshot objects were first introduced,
> since all the other vir*Ptr objects have at least a GetName accessor.
>
> * include/libvirt/libvirt.h.in (virDomainSnapshotGetName)
> (virDomainSnapshotGetDomain, virDomainSnapshotGetConnect): Declare.
> * src/libvirt.c (virDomainSnapshotGetName)
> (virDomainSnapshotGetDomain, virDomainSnapshotGetConnect): New
> functions.
> * src/libvirt_public.syms: Export them.
> ---
>   include/libvirt/libvirt.h.in |    4 ++
>   src/libvirt.c                |   73 ++++++++++++++++++++++++++++++++++++++++++
>   src/libvirt_public.syms      |    5 ++-
>   3 files changed, 81 insertions(+), 1 deletions(-)
>
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 5fa489e..ea7b3fc 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -2656,6 +2656,10 @@ typedef struct _virDomainSnapshot virDomainSnapshot;
>    */
>   typedef virDomainSnapshot *virDomainSnapshotPtr;
>
> +const char *virDomainSnapshotGetName(virDomainSnapshotPtr snapshot);
> +virDomainPtr virDomainSnapshotGetDomain(virDomainSnapshotPtr snapshot);
> +virConnectPtr virDomainSnapshotGetConnect(virDomainSnapshotPtr snapshot);

By the way, it is intentional that these 3 APIs do _not_ have an 
unsigned int flags argument - we are consistent that none of our 
accessor functions have a flags argument, and since there is no rpc call 
involved, we know up front that these APIs will never be extended.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list