[libvirt] [PATCH 1/2] include: declare typed parameter handling earlier

Eric Blake eblake at redhat.com
Tue Oct 23 18:01:02 UTC 2012


Commit 12ad7435 added new functions (virNodeGetMemoryParameters,
virNodeSetMemoryParameters) into the section of the file reserved
for deprecated names.  Fix this by moving things earlier; split
into two patches to make git diff easier to read.

* include/libvirt/libvirt.h.in: Move virTypedParameter earlier.
---
 include/libvirt/libvirt.h.in | 174 ++++++++++++++++++++++---------------------
 1 file changed, 88 insertions(+), 86 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 52555f8..7d6a064 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -432,6 +432,94 @@ typedef struct _virSecurityModel {
  */
 typedef virSecurityModel *virSecurityModelPtr;

+/* Common data types shared among interfaces with name/type/value lists.  */
+
+/**
+ * virTypedParameterType:
+ *
+ * Express the type of a virTypedParameter
+ */
+typedef enum {
+    VIR_TYPED_PARAM_INT     = 1, /* integer case */
+    VIR_TYPED_PARAM_UINT    = 2, /* unsigned integer case */
+    VIR_TYPED_PARAM_LLONG   = 3, /* long long case */
+    VIR_TYPED_PARAM_ULLONG  = 4, /* unsigned long long case */
+    VIR_TYPED_PARAM_DOUBLE  = 5, /* double case */
+    VIR_TYPED_PARAM_BOOLEAN = 6, /* boolean(character) case */
+    VIR_TYPED_PARAM_STRING  = 7, /* string case */
+
+#ifdef VIR_ENUM_SENTINELS
+    VIR_TYPED_PARAM_LAST
+#endif
+} virTypedParameterType;
+
+/**
+ * virTypedParameterFlags:
+ *
+ * Flags related to libvirt APIs that use virTypedParameter.
+ *
+ * These enums should not conflict with those of virDomainModificationImpact.
+ */
+typedef enum {
+    /* 1 << 0 is reserved for virDomainModificationImpact */
+    /* 1 << 1 is reserved for virDomainModificationImpact */
+
+    /* Older servers lacked the ability to handle string typed
+     * parameters.  Attempts to set a string parameter with an older
+     * server will fail at the client, but attempts to retrieve
+     * parameters must not return strings from a new server to an
+     * older client, so this flag exists to identify newer clients to
+     * newer servers.  This flag is automatically set when needed, so
+     * the user does not have to worry about it; however, manually
+     * setting the flag can be used to reject servers that cannot
+     * return typed strings, even if no strings would be returned.
+     */
+    VIR_TYPED_PARAM_STRING_OKAY = 1 << 2,
+
+} virTypedParameterFlags;
+
+/**
+ * VIR_TYPED_PARAM_FIELD_LENGTH:
+ *
+ * Macro providing the field length of virTypedParameter name
+ */
+#define VIR_TYPED_PARAM_FIELD_LENGTH 80
+
+/**
+ * virTypedParameter:
+ *
+ * A named parameter, including a type and value.
+ *
+ * The types virSchedParameter, virBlkioParameter, and
+ * virMemoryParameter are aliases of this type, for use when
+ * targetting libvirt earlier than 0.9.2.
+ */
+typedef struct _virTypedParameter virTypedParameter;
+
+struct _virTypedParameter {
+    char field[VIR_TYPED_PARAM_FIELD_LENGTH];  /* parameter name */
+    int type;   /* parameter type, virTypedParameterType */
+    union {
+        int i;                      /* type is INT */
+        unsigned int ui;            /* type is UINT */
+        long long int l;            /* type is LLONG */
+        unsigned long long int ul;  /* type is ULLONG */
+        double d;                   /* type is DOUBLE */
+        char b;                     /* type is BOOLEAN */
+        char *s;                    /* type is STRING, may not be NULL */
+    } value; /* parameter value */
+};
+
+/**
+ * virTypedParameterPtr:
+ *
+ * a pointer to a virTypedParameter structure.
+ */
+typedef virTypedParameter *virTypedParameterPtr;
+
+
+/* data types relate to virNodePtr */
+
 /**
  * virNodeInfoPtr:
  *
@@ -587,92 +675,6 @@ struct _virNodeMemoryStats {
     unsigned long long value;
 };

-/* Common data types shared among interfaces with name/type/value lists.  */
-
-/**
- * virTypedParameterType:
- *
- * Express the type of a virTypedParameter
- */
-typedef enum {
-    VIR_TYPED_PARAM_INT     = 1, /* integer case */
-    VIR_TYPED_PARAM_UINT    = 2, /* unsigned integer case */
-    VIR_TYPED_PARAM_LLONG   = 3, /* long long case */
-    VIR_TYPED_PARAM_ULLONG  = 4, /* unsigned long long case */
-    VIR_TYPED_PARAM_DOUBLE  = 5, /* double case */
-    VIR_TYPED_PARAM_BOOLEAN = 6, /* boolean(character) case */
-    VIR_TYPED_PARAM_STRING  = 7, /* string case */
-
-#ifdef VIR_ENUM_SENTINELS
-    VIR_TYPED_PARAM_LAST
-#endif
-} virTypedParameterType;
-
-/**
- * virTypedParameterFlags:
- *
- * Flags related to libvirt APIs that use virTypedParameter.
- *
- * These enums should not conflict with those of virDomainModificationImpact.
- */
-typedef enum {
-    /* 1 << 0 is reserved for virDomainModificationImpact */
-    /* 1 << 1 is reserved for virDomainModificationImpact */
-
-    /* Older servers lacked the ability to handle string typed
-     * parameters.  Attempts to set a string parameter with an older
-     * server will fail at the client, but attempts to retrieve
-     * parameters must not return strings from a new server to an
-     * older client, so this flag exists to identify newer clients to
-     * newer servers.  This flag is automatically set when needed, so
-     * the user does not have to worry about it; however, manually
-     * setting the flag can be used to reject servers that cannot
-     * return typed strings, even if no strings would be returned.
-     */
-    VIR_TYPED_PARAM_STRING_OKAY = 1 << 2,
-
-} virTypedParameterFlags;
-
-/**
- * VIR_TYPED_PARAM_FIELD_LENGTH:
- *
- * Macro providing the field length of virTypedParameter name
- */
-#define VIR_TYPED_PARAM_FIELD_LENGTH 80
-
-/**
- * virTypedParameter:
- *
- * A named parameter, including a type and value.
- *
- * The types virSchedParameter, virBlkioParameter, and
- * virMemoryParameter are aliases of this type, for use when
- * targetting libvirt earlier than 0.9.2.
- */
-typedef struct _virTypedParameter virTypedParameter;
-
-struct _virTypedParameter {
-    char field[VIR_TYPED_PARAM_FIELD_LENGTH];  /* parameter name */
-    int type;   /* parameter type, virTypedParameterType */
-    union {
-        int i;                      /* type is INT */
-        unsigned int ui;            /* type is UINT */
-        long long int l;            /* type is LLONG */
-        unsigned long long int ul;  /* type is ULLONG */
-        double d;                   /* type is DOUBLE */
-        char b;                     /* type is BOOLEAN */
-        char *s;                    /* type is STRING, may not be NULL */
-    } value; /* parameter value */
-};
-
-/**
- * virTypedParameterPtr:
- *
- * a pointer to a virTypedParameter structure.
- */
-typedef virTypedParameter *virTypedParameterPtr;
-
-
 /* Management of scheduler parameters */

 /**
-- 
1.7.11.7




More information about the libvir-list mailing list