[libvirt PATCH 3/3] qemu: use qemuVirCommandGetDevSet less

Ján Tomko posted 3 patches 4 years ago
[libvirt PATCH 3/3] qemu: use qemuVirCommandGetDevSet less
Posted by Ján Tomko 4 years ago
Do not look up the index of the passed FD in places where
we already have it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_command.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d9c6c4bc43..33f9b96bf8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4628,7 +4628,6 @@ qemuBuildChrChardevFileStr(virLogManagerPtr logManager,
 {
     if (logManager) {
         g_autofree char *fdset = NULL;
-        g_autofree char *fdpath = NULL;
         int flags = 0;
         int logfd;
         size_t idx;
@@ -4652,10 +4651,7 @@ qemuBuildChrChardevFileStr(virLogManagerPtr logManager,
         virCommandAddArg(cmd, "-add-fd");
         virCommandAddArg(cmd, fdset);
 
-        if (!(fdpath = qemuVirCommandGetDevSet(cmd, logfd)))
-            return -1;
-
-        virBufferAsprintf(buf, ",%s=%s,%s=on", filearg, fdpath, appendarg);
+        virBufferAsprintf(buf, ",%s=/dev/fdset/%zu,%s=on", filearg, idx, appendarg);
     } else {
         virBufferAsprintf(buf, ",%s=", filearg);
         virQEMUBuildBufferEscapeComma(buf, fileval);
@@ -8204,7 +8200,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
 
         virCommandPassFDIndex(cmd, vdpafd, VIR_COMMAND_PASS_FD_CLOSE_PARENT, &idx);
         fdset = qemuBuildFDSet(vdpafd, idx);
-        vdpafdName = qemuVirCommandGetDevSet(cmd, vdpafd);
+        vdpafdName = g_strdup_printf("/dev/fdset/%zu", idx);
         /* set opaque to the devicepath so that we can look up the fdset later
          * if necessary */
         addfdarg = g_strdup_printf("%s,opaque=%s", fdset,
-- 
2.26.2