From: Ján Tomko Date: Tue, 24 Nov 2020 13:49:19 +0000 (+0100) Subject: qemu: use qemuVirCommandGetDevSet less X-Git-Tag: v7.0.0-rc1~379 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5c028697cd0541ad647b1bc3fef3c839d0406737;p=thirdparty%2Flibvirt.git qemu: use qemuVirCommandGetDevSet less Do not look up the index of the passed FD in places where we already have it. Signed-off-by: Ján Tomko Reviewed-by: Peter Krempa --- 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,