[PATCH 04/20] qemu: Add function to get bool value from migration params

Jim Fehlig via Devel posted 20 patches 3 months, 2 weeks ago
[PATCH 04/20] qemu: Add function to get bool value from migration params
Posted by Jim Fehlig via Devel 3 months, 2 weeks ago
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 src/qemu/qemu_migration_params.c | 18 ++++++++++++++++++
 src/qemu/qemu_migration_params.h |  5 +++++
 2 files changed, 23 insertions(+)

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index c3c9120c22..daa52269f4 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1303,6 +1303,24 @@ qemuMigrationParamsGetULL(qemuMigrationParams *migParams,
 }
 
 
+int
+qemuMigrationParamsGetBool(qemuMigrationParams *migParams,
+                           qemuMigrationParam param,
+                           bool *value)
+{
+    if (!migParams || !value)
+        return 0;
+
+    if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_BOOL) < 0)
+        return -1;
+
+    *value = migParams->params[param].set ?
+        migParams->params[param].value.b : false;
+
+    return 0;
+}
+
+
 /**
  * Returns true if @cap is enabled in @migParams, false otherwise.
  */
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 020071e8ef..64b2dde59b 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -136,6 +136,11 @@ qemuMigrationParamsGetULL(qemuMigrationParams *migParams,
                           qemuMigrationParam param,
                           unsigned long long *value);
 
+int
+qemuMigrationParamsGetBool(qemuMigrationParams *migParams,
+                           qemuMigrationParam param,
+                           bool *value);
+
 bool
 qemuMigrationParamsCapEnabled(qemuMigrationParams *migParams,
                               qemuMigrationCapability cap);
-- 
2.35.3
Re: [PATCH 04/20] qemu: Add function to get bool value from migration params
Posted by Daniel P. Berrangé 1 month, 2 weeks ago
On Thu, Aug 08, 2024 at 05:37:57PM -0600, Jim Fehlig via Devel wrote:
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  src/qemu/qemu_migration_params.c | 18 ++++++++++++++++++
>  src/qemu/qemu_migration_params.h |  5 +++++
>  2 files changed, 23 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|