[PATCH 11/22] remote generator, daemon: Handle the CPU functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



They require additional special cases.
---
 daemon/remote.c                     |   64 -----------------------------------
 daemon/remote_dispatch_bodies.c     |   62 ++++++++++++++++++++++++++++++++--
 daemon/remote_dispatch_prototypes.h |    6 ++--
 daemon/remote_dispatch_table.h      |   12 +++---
 daemon/remote_generator.pl          |   20 ++++++++---
 5 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 4c05567..f70c445 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -3059,70 +3059,6 @@ cleanup:
 }
 
 static int
-remoteDispatchCpuCompare(struct qemud_server *server ATTRIBUTE_UNUSED,
-                         struct qemud_client *client ATTRIBUTE_UNUSED,
-                         virConnectPtr conn,
-                         remote_message_header *hdr ATTRIBUTE_UNUSED,
-                         remote_error *rerr,
-                         remote_cpu_compare_args *args,
-                         remote_cpu_compare_ret *ret)
-{
-    int result;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if ((result = virConnectCompareCPU(conn, args->xml, args->flags)) == VIR_CPU_COMPARE_ERROR)
-        goto cleanup;
-
-    ret->result = result;
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    return rv;
-}
-
-
-static int
-remoteDispatchCpuBaseline(struct qemud_server *server ATTRIBUTE_UNUSED,
-                          struct qemud_client *client ATTRIBUTE_UNUSED,
-                          virConnectPtr conn,
-                          remote_message_header *hdr ATTRIBUTE_UNUSED,
-                          remote_error *rerr,
-                          remote_cpu_baseline_args *args,
-                          remote_cpu_baseline_ret *ret)
-{
-    char *cpu;
-    int rv = -1;
-
-    if (!conn) {
-        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
-        goto cleanup;
-    }
-
-    if (!(cpu = virConnectBaselineCPU(conn,
-                                      (const char **) args->xmlCPUs.xmlCPUs_val,
-                                      args->xmlCPUs.xmlCPUs_len,
-                                      args->flags)))
-        goto cleanup;
-
-    ret->cpu = cpu;
-
-    rv = 0;
-
-cleanup:
-    if (rv < 0)
-        remoteDispatchError(rerr);
-    return rv;
-}
-
-
-static int
 remoteDispatchDomainGetJobInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
                                struct qemud_client *client ATTRIBUTE_UNUSED,
                                virConnectPtr conn,
diff --git a/daemon/remote_dispatch_bodies.c b/daemon/remote_dispatch_bodies.c
index d12988e..89f0bc4 100644
--- a/daemon/remote_dispatch_bodies.c
+++ b/daemon/remote_dispatch_bodies.c
@@ -14,9 +14,65 @@
 
 /* remoteDispatchClose has to be implemented manually */
 
-/* remoteDispatchCpuBaseline has to be implemented manually */
+static int
+remoteDispatchCPUBaseline(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_cpu_baseline_args *args,
+    remote_cpu_baseline_ret *ret)
+{
+    int rv = -1;
+    char *cpu;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((cpu = virConnectBaselineCPU(conn, (const char **)args->xmlCPUs.xmlCPUs_val, args->xmlCPUs.xmlCPUs_len, args->flags)) == NULL)
+        goto cleanup;
+
+    ret->cpu = cpu;
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    return rv;
+}
+
+static int
+remoteDispatchCPUCompare(
+    struct qemud_server *server ATTRIBUTE_UNUSED,
+    struct qemud_client *client ATTRIBUTE_UNUSED,
+    virConnectPtr conn,
+    remote_message_header *hdr ATTRIBUTE_UNUSED,
+    remote_error *rerr,
+    remote_cpu_compare_args *args,
+    remote_cpu_compare_ret *ret)
+{
+    int rv = -1;
+    int result;
+
+    if (!conn) {
+        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if ((result = virConnectCompareCPU(conn, args->xml, args->flags)) == VIR_CPU_COMPARE_ERROR)
+        goto cleanup;
+
+    ret->result = result;
+    rv = 0;
 
-/* remoteDispatchCpuCompare has to be implemented manually */
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    return rv;
+}
 
 static int
 remoteDispatchDomainAbortJob(
@@ -523,7 +579,7 @@ cleanup:
 /* remoteDispatchDomainGetMemoryParameters has to be implemented manually */
 
 static int
-remoteDispatchDomainGetOsType(
+remoteDispatchDomainGetOSType(
     struct qemud_server *server ATTRIBUTE_UNUSED,
     struct qemud_client *client ATTRIBUTE_UNUSED,
     virConnectPtr conn,
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index 1e3be48..b6819c0 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -50,7 +50,7 @@ static int remoteDispatchClose(
     remote_error *rerr,
     void *args,
     void *ret);
-static int remoteDispatchCpuBaseline(
+static int remoteDispatchCPUBaseline(
     struct qemud_server *server,
     struct qemud_client *client,
     virConnectPtr conn,
@@ -58,7 +58,7 @@ static int remoteDispatchCpuBaseline(
     remote_error *rerr,
     remote_cpu_baseline_args *args,
     remote_cpu_baseline_ret *ret);
-static int remoteDispatchCpuCompare(
+static int remoteDispatchCPUCompare(
     struct qemud_server *server,
     struct qemud_client *client,
     virConnectPtr conn,
@@ -274,7 +274,7 @@ static int remoteDispatchDomainGetMemoryParameters(
     remote_error *rerr,
     remote_domain_get_memory_parameters_args *args,
     remote_domain_get_memory_parameters_ret *ret);
-static int remoteDispatchDomainGetOsType(
+static int remoteDispatchDomainGetOSType(
     struct qemud_server *server,
     struct qemud_client *client,
     virConnectPtr conn,
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index 357d1de..c140341 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -97,8 +97,8 @@
     .args_filter = (xdrproc_t) xdr_remote_domain_get_max_vcpus_args,
     .ret_filter = (xdrproc_t) xdr_remote_domain_get_max_vcpus_ret,
 },
-{   /* DomainGetOsType => 19 */
-    .fn = (dispatch_fn) remoteDispatchDomainGetOsType,
+{   /* DomainGetOSType => 19 */
+    .fn = (dispatch_fn) remoteDispatchDomainGetOSType,
     .args_filter = (xdrproc_t) xdr_remote_domain_get_os_type_args,
     .ret_filter = (xdrproc_t) xdr_remote_domain_get_os_type_ret,
 },
@@ -792,8 +792,8 @@
     .args_filter = (xdrproc_t) xdr_void,
     .ret_filter = (xdrproc_t) xdr_remote_get_lib_version_ret,
 },
-{   /* CpuCompare => 158 */
-    .fn = (dispatch_fn) remoteDispatchCpuCompare,
+{   /* CPUCompare => 158 */
+    .fn = (dispatch_fn) remoteDispatchCPUCompare,
     .args_filter = (xdrproc_t) xdr_remote_cpu_compare_args,
     .ret_filter = (xdrproc_t) xdr_remote_cpu_compare_ret,
 },
@@ -812,8 +812,8 @@
     .args_filter = (xdrproc_t) xdr_remote_domain_detach_device_flags_args,
     .ret_filter = (xdrproc_t) xdr_void,
 },
-{   /* CpuBaseline => 162 */
-    .fn = (dispatch_fn) remoteDispatchCpuBaseline,
+{   /* CPUBaseline => 162 */
+    .fn = (dispatch_fn) remoteDispatchCPUBaseline,
     .args_filter = (xdrproc_t) xdr_remote_cpu_baseline_args,
     .ret_filter = (xdrproc_t) xdr_remote_cpu_baseline_ret,
 },
diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index 585cf67..2ddfdc0 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -34,7 +34,8 @@ sub name_to_ProcName {
     @elems = map ucfirst, @elems;
     @elems = map { $_ =~ s/Nwfilter/NWFilter/; $_ =~ s/Xml/XML/;
                    $_ =~ s/Uri/URI/; $_ =~ s/Uuid/UUID/; $_ =~ s/Id/ID/;
-                   $_ =~ s/Mac/MAC/; $_ } @elems;
+                   $_ =~ s/Mac/MAC/; $_ =~ s/Cpu/CPU/; $_ =~ s/Os/OS/;
+                   $_ } @elems;
     join "", @elems
 }
 
@@ -257,8 +258,6 @@ elsif ($opt_b) {
                           "AuthSaslStep",
                           "AuthPolkit",
 
-                          "CpuBaseline",
-                          "CpuCompare",
                           "DomainBlockPeek",
                           "DomainBlockStats",
                           "DomainCreateWithFlags",
@@ -387,6 +386,8 @@ elsif ($opt_b) {
 
                     if ($calls{$_}->{ProcName} eq "SecretSetValue") {
                         push(@args_list, "(const unsigned char *)args->$1.$1_val");
+                    } elsif ($calls{$_}->{ProcName} eq "CPUBaseline") {
+                        push(@args_list, "(const char **)args->$1.$1_val");
                     } else {
                         push(@args_list, "args->$1.$1_val");
                     }
@@ -490,7 +491,12 @@ elsif ($opt_b) {
                         $single_ret_by_ref = 1;
                     } else {
                         $single_ret_by_ref = 0;
-                        $single_ret_check = " < 0";
+
+                        if ($calls{$_}->{ProcName} eq "CPUCompare") {
+                            $single_ret_check = " == VIR_CPU_COMPARE_ERROR";
+                        } else {
+                            $single_ret_check = " < 0";
+                        }
                     }
                 } elsif ($ret_member =~ m/hyper (\S+)<(\S+)>;/) {
                     push(@vars_list, "int len");
@@ -596,8 +602,10 @@ elsif ($opt_b) {
                 $prefix = "Drv"
             } elsif ($calls{$_}->{ProcName} =~ m/^(\S+)DumpXML$/) {
                 $proc_name = "${1}GetXMLDesc"
-            } elsif ($calls{$_}->{ProcName} eq "DomainGetOsType") {
-                $proc_name = "DomainGetOSType"
+            } elsif ($calls{$_}->{ProcName} eq "CPUBaseline") {
+                $proc_name = "ConnectBaselineCPU"
+            } elsif ($calls{$_}->{ProcName} eq "CPUCompare") {
+                $proc_name = "ConnectCompareCPU"
             }
 
             if ($single_ret_as_list) {
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]