[libvirt] [PATCH 10/19] storage: Create accessor API's for virStoragePoolObj

Pavel Hrdina phrdina at redhat.com
Fri Jul 14 15:37:23 UTC 2017


On Tue, May 09, 2017 at 11:30:17AM -0400, John Ferlan wrote:
> In preparation for making a private object, create accessor API's for
> consumer storage functions to use:
> 
>     virStoragePoolObjGetDef
>     virStoragePoolObjGetNewDef
>     virStoragePoolObjStealNewDef
>     virStoragePoolObjGetConfigFile
>     virStoragePoolObjSetConfigFile
>     virStoragePoolObjIsActive
>     virStoragePoolObjSetActive
>     virStoragePoolObjGetAsyncjobs
>     virStoragePoolObjIncrAsyncjobs
>     virStoragePoolObjDecrAsyncjobs
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/virstorageobj.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/conf/virstorageobj.h | 36 +++++++++++++++++++----
>  src/libvirt_private.syms | 10 +++++++
>  3 files changed, 115 insertions(+), 5 deletions(-)
> 
> diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
> index 23346f3..7d6b311 100644
> --- a/src/conf/virstorageobj.c
> +++ b/src/conf/virstorageobj.c
> @@ -37,6 +37,80 @@
>  VIR_LOG_INIT("conf.virstorageobj");

[...]

> +void
> +virStoragePoolObjStealNewDef(virStoragePoolObjPtr obj)
> +{
> +    virStoragePoolDefFree(obj->def);
> +    obj->def = obj->newDef;
> +    obj->newDef = NULL;
> +}

I didn't notice this until the usage in following patches, the "Steal"
part of the name is confusing.  We have a macro "VIR_STEAL_PTR" which
returns pointer and sets the original one to NULL.  This function
doesn't return the pointer, it replaces @def with @newDef.

How about virStoragePoolObjUseNewDef() or
virStoragePoolObjDefUseNewDef() or feel free to come up with another
name which would be better than "Steel".

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170714/64a5f88e/attachment-0001.sig>


More information about the libvir-list mailing list