[libvirt] [PATCH v2 1/4] util: Introduce virTypedParameterRemote datatype

Erik Skultety eskultet at redhat.com
Wed Feb 3 14:51:52 UTC 2016


Both admin and remote protocols define their own types
(remote_typed_param vs admin_typed_param). Because of the naming convention,
admin typed params wouldn't be able to reuse the serialization/deserialization
methods, which are tailored for use by remote protocol, even if those method
were exported properly. In that case, introduce a new internal data type
structurally copying both admin and remote protocols which, eventually, would
allow serializer and deserializer to be used in a more generic way.
---
 src/util/virtypedparam.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h
index 9bef204..7dd3a78 100644
--- a/src/util/virtypedparam.h
+++ b/src/util/virtypedparam.h
@@ -36,6 +36,30 @@
 
 verify(!(VIR_TYPED_PARAM_LAST & VIR_TYPED_PARAM_MULTIPLE));
 
+typedef struct _virTypedParameterRemoteValue virTypedParameterRemoteValue;
+typedef struct virTypedParameterRemoteValue *virTypedParameterRemoteValuePtr;
+
+struct _virTypedParameterRemoteValue {
+    int type;
+    union {
+        int i; /* exempt from syntax-check */
+        unsigned int ui;
+        long long int l;
+        unsigned long long int ul;
+        double d;
+        char b;
+        char *s;
+    } remote_typed_param_value;
+};
+
+typedef struct _virTypedParameterRemote *virTypedParameterRemotePtr;
+
+struct _virTypedParameterRemote {
+    char *field;
+    virTypedParameterRemoteValue value;
+};
+
+
 int virTypedParamsValidate(virTypedParameterPtr params, int nparams,
                            /* const char *name, int type ... */ ...)
     ATTRIBUTE_SENTINEL ATTRIBUTE_RETURN_CHECK;
-- 
2.4.3




More information about the libvir-list mailing list