
On 07/14/2017 11:37 AM, Pavel Hrdina wrote:
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@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
It's theft by deception. How about virStoragePoolObjDefSwapNewDef John