ESX: Fix ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY

Fix addresses two issues:
1. Fix generator code to allow deep copy operation for objects with
   Dynamic_Cast capabilities.
2. Add missing deep copy routine to Long datatype.

Signed-off-by: Ata E Husain Bohra <ata.husain@hotmail.com>
This commit is contained in:
Ata E Husain Bohra 2012-07-18 23:14:18 -07:00 committed by Matthias Bolte
parent d4611c0ee3
commit 04d9cf8e6c
4 changed files with 17 additions and 2 deletions

View File

@ -250,6 +250,7 @@ Patches have also been contributed by:
Sascha Peilicke <saschpe@suse.de>
Chuck Short <chuck.short@canonical.com>
Sebastian Wiedenroth <wiedi@frubar.net>
Ata E Husain Bohra <ata.husain@hotmail.com>
[....send patches to get your name here....]
The libvirt Logo was designed by Diana Fong

View File

@ -832,7 +832,7 @@ class Object(Type):
else:
if self.features & Object.FEATURE__DEEP_COPY:
source += "/* esxVI_%s_DeepCopy */\n" % self.name
source += "ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY(%s)\n" % self.name
source += "ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY(%s,\n" % self.name
source += "{\n"
for extended_by in self.extended_by:

View File

@ -559,7 +559,7 @@
#define ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(_type) \
case esxVI_Type_##_type: \
return esxVI_##_type##_DeepCopy((esxVI_##_type **)dst, \
return esxVI_##_type##_DeepCopy((esxVI_##_type **)dest, \
(esxVI_##_type *)src);
@ -618,6 +618,13 @@
#define ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY(__type, _dispatch, _deep_copy) \
ESX_VI__TEMPLATE__DEEP_COPY(__type, \
ESX_VI__TEMPLATE__DISPATCH(src->_type, __type, _dispatch, -1) \
_deep_copy)
#define ESX_VI__TEMPLATE__DYNAMIC_CAST_FROM_ANY_TYPE(__type, _dispatch) \
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(__type, esxVI_##__type, \
ESX_VI__TEMPLATE__DISPATCH(anyType->type, __type, _dispatch, -1), \
@ -1337,6 +1344,12 @@ ESX_VI__TEMPLATE__VALIDATE(Long,
/* esxVI_Long_AppendToList */
ESX_VI__TEMPLATE__LIST__APPEND(Long)
/* esxVI_Long_DeepCopy */
ESX_VI__TEMPLATE__DEEP_COPY(Long,
{
(*dest)->value = src->value;
})
/* esxVI_Long_CastFromAnyType */
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(Long)

View File

@ -236,6 +236,7 @@ int esxVI_Long_Alloc(esxVI_Long **number);
void esxVI_Long_Free(esxVI_Long **numberList);
int esxVI_Long_Validate(esxVI_Long *number);
int esxVI_Long_AppendToList(esxVI_Long **numberList, esxVI_Long *number);
int esxVI_Long_DeepCopy(esxVI_Long **dest, esxVI_Long *src);
int esxVI_Long_CastFromAnyType(esxVI_AnyType *anyType, esxVI_Long **number);
int esxVI_Long_Serialize(esxVI_Long *number, const char *element,
virBufferPtr output);