From 04d9cf8e6cf5e19938965f9f05b8e5f4038c40eb Mon Sep 17 00:00:00 2001 From: Ata E Husain Bohra Date: Wed, 18 Jul 2012 23:14:18 -0700 Subject: [PATCH] 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 --- AUTHORS | 1 + src/esx/esx_vi_generator.py | 2 +- src/esx/esx_vi_types.c | 15 ++++++++++++++- src/esx/esx_vi_types.h | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 092e279d1f..ca823895ad 100644 --- a/AUTHORS +++ b/AUTHORS @@ -250,6 +250,7 @@ Patches have also been contributed by: Sascha Peilicke Chuck Short Sebastian Wiedenroth + Ata E Husain Bohra [....send patches to get your name here....] The libvirt Logo was designed by Diana Fong diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 8a128df9e1..97b8e15f36 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -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: diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index 9e67effbbe..8e22b66b81 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -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) diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h index 3d843bff9f..a44d783257 100644 --- a/src/esx/esx_vi_types.h +++ b/src/esx/esx_vi_types.h @@ -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);