]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_command: Extract building IOMMUFD props to function
authorPavel Hrdina <phrdina@redhat.com>
Sun, 15 Feb 2026 19:10:50 +0000 (20:10 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 16 Feb 2026 14:50:39 +0000 (15:50 +0100)
This will be reused by hotplug code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_command.c
src/qemu/qemu_command.h

index cdf2f91ece086e325a1228750340949425b5d672..a742998e4c7b00a6eb21b51fb874b29a802da3da 100644 (file)
@@ -5344,6 +5344,21 @@ qemuBuildHostdevCommandLine(virCommand *cmd,
 }
 
 
+virJSONValue *
+qemuBuildIOMMUFDProps(qemuFDPassDirect *iommufd)
+{
+    g_autoptr(virJSONValue) props = NULL;
+
+    if (qemuMonitorCreateObjectProps(&props, "iommufd",
+                                     "iommufd0",
+                                     "S:fd", qemuFDPassDirectGetPath(iommufd),
+                                     NULL) < 0)
+        return NULL;
+
+    return g_steal_pointer(&props);
+}
+
+
 static int
 qemuBuildIOMMUFDCommandLine(virCommand *cmd,
                             const virDomainDef *def,
@@ -5357,10 +5372,7 @@ qemuBuildIOMMUFDCommandLine(virCommand *cmd,
 
     qemuFDPassDirectTransferCommand(priv->iommufd, cmd);
 
-    if (qemuMonitorCreateObjectProps(&props, "iommufd",
-                                     "iommufd0",
-                                     "S:fd", qemuFDPassDirectGetPath(priv->iommufd),
-                                     NULL) < 0)
+    if (!(props = qemuBuildIOMMUFDProps(priv->iommufd)))
         return -1;
 
     if (qemuBuildObjectCommandlineFromJSON(cmd, props) < 0)
index ad068f1f1689480f32295497d72f0564439e75db..028d002ef9e87391095d080268027fc5443fe451 100644 (file)
@@ -190,6 +190,9 @@ int
 qemuBuildRNGBackendProps(virDomainRNGDef *rng,
                          virJSONValue **props);
 
+virJSONValue *
+qemuBuildIOMMUFDProps(qemuFDPassDirect *iommufd);
+
 /* Current, best practice */
 virJSONValue *
 qemuBuildUSBHostdevDevProps(const virDomainDef *def,