]> xenbits.xensource.com Git - libvirt.git/commitdiff
admin: Enable usage of typed parameters
authorErik Skultety <eskultet@redhat.com>
Mon, 25 Jan 2016 15:30:27 +0000 (16:30 +0100)
committerErik Skultety <eskultet@redhat.com>
Mon, 18 Apr 2016 15:06:19 +0000 (17:06 +0200)
Make all relevant changes to admin protocol, in order to achieve $(subj)

Signed-off-by: Erik Skultety <eskultet@redhat.com>
cfg.mk
src/admin/admin_protocol.x
src/admin_protocol-structs

diff --git a/cfg.mk b/cfg.mk
index fccb45a3cd7bd9e7c236653d9ef206c7873f7f53..16da2b3fb9fe8438dd719c8ea843702f04846ed2 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -1248,7 +1248,7 @@ exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
   ^(tools/|examples/|include/libvirt/(virterror|libvirt(-(admin|qemu|lxc))?)\.h$$)
 
 exclude_file_name_regexp--sc_prohibit_int_ijk = \
-  ^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$
+  ^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/|src/admin_protocol-structs|src/admin/admin_protocol.x)$
 
 exclude_file_name_regexp--sc_prohibit_getenv = \
   ^tests/.*\.[ch]$$
index 6590980ce1cacf185e2067f361451b6a0f49e004..57dbb6b103fcaef49821603b3934134c76437e77 100644 (file)
@@ -22,6 +22,7 @@
  * Author: Martin Kletzander <mkletzan@redhat.com>
  */
 
+%#include <libvirt/libvirt-admin.h>
 %#include "virxdrdefs.h"
 
 /*----- Data types. -----*/
@@ -41,12 +42,35 @@ typedef string admin_nonnull_string<ADMIN_STRING_MAX>;
 /* A long string, which may be NULL. */
 typedef admin_nonnull_string *admin_string;
 
+union admin_typed_param_value switch (int type) {
+ case VIR_TYPED_PARAM_INT:
+     int i;
+ case VIR_TYPED_PARAM_UINT:
+     unsigned int ui;
+ case VIR_TYPED_PARAM_LLONG:
+     hyper l;
+ case VIR_TYPED_PARAM_ULLONG:
+     unsigned hyper ul;
+ case VIR_TYPED_PARAM_DOUBLE:
+     double d;
+ case VIR_TYPED_PARAM_BOOLEAN:
+     int b;
+ case VIR_TYPED_PARAM_STRING:
+     admin_nonnull_string s;
+};
+
+struct admin_typed_param {
+    admin_nonnull_string field;
+    admin_typed_param_value value;
+};
+
 /* A server which may NOT be NULL */
 struct admin_nonnull_server {
     admin_nonnull_string name;
 };
 
 /*----- Protocol. -----*/
+
 struct admin_connect_open_args {
     unsigned int flags;
 };
index d8aca06171471a5420e880bea9d4bfa59708eb7e..26c84439f4684b81067ead66607ea39b95e6ff89 100644 (file)
@@ -1,4 +1,29 @@
 /* -*- c -*- */
+enum {
+        VIR_TYPED_PARAM_INT = 1,
+        VIR_TYPED_PARAM_UINT = 2,
+        VIR_TYPED_PARAM_LLONG = 3,
+        VIR_TYPED_PARAM_ULLONG = 4,
+        VIR_TYPED_PARAM_DOUBLE = 5,
+        VIR_TYPED_PARAM_BOOLEAN = 6,
+        VIR_TYPED_PARAM_STRING = 7,
+};
+struct admin_typed_param_value {
+        int                        type;
+        union {
+                int                i;
+                u_int              ui;
+                int64_t            l;
+                uint64_t           ul;
+                double             d;
+                int                b;
+                admin_nonnull_string s;
+        } admin_typed_param_value_u;
+};
+struct admin_typed_param {
+        admin_nonnull_string       field;
+        admin_typed_param_value    value;
+};
 struct admin_nonnull_server {
         admin_nonnull_string       name;
 };