From nobody Sun Feb 8 19:57:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568909544; cv=none; d=zoho.com; s=zohoarc; b=HqMV5SlurXBffyES4epmSceR/1ilTIvaf2Ge3pgWMFJtIsqEOs6strZSaWRXry9JTA4thnpIOFTlFBzWAaBDwaPvpkVHjzOJzSt4cdJYNgvU3Tl0SlkOUZNiU0WPxo2RPuU8Uik7z7ItTmJfw1ODOpGuHgMep+lftE6uV5o3El8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568909544; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lVZO6X5WxjMo4LlOlDD2LB/Vputy0U0UlbN0c1h1WVY=; b=IGq6Xx7cmbomeeBtaw0mB3JTbQMKQwE2vhB2SRnE59c/rAPVCQgt7mh/ZGeMZfTISAKt4W/SREMdwpbozkHGFTSFNtTMN52dI4AXTpO9yc0vkRT9AyaSH+gUyz8pZB0ddCDskZ9H5vPYMS2xwYEnrhOYcyLh0keot8J56eymEJI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568909544995817.0251457508573; Thu, 19 Sep 2019 09:12:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39D874FCD6; Thu, 19 Sep 2019 16:12:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15A5A5D704; Thu, 19 Sep 2019 16:12:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C5874180085A; Thu, 19 Sep 2019 16:12:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8JGASNq032254 for ; Thu, 19 Sep 2019 12:10:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4265B60C57; Thu, 19 Sep 2019 16:10:28 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98B0E60C80 for ; Thu, 19 Sep 2019 16:10:27 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Sep 2019 18:10:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/8] qemu: monitor: Remove legacy monitor commands for FD manipulation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 19 Sep 2019 16:12:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The handlers for 'add-fd' and 'remove-fd' are unused now and riddled with legacy cruft. Purge them. Last use was removed in f2019083de3430101b94d4991a38fd947a08fd32. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 53 ------------------------- src/qemu/qemu_monitor.h | 4 +- src/qemu/qemu_monitor_json.c | 75 ------------------------------------ src/qemu/qemu_monitor_json.h | 3 -- 4 files changed, 1 insertion(+), 134 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index aa230b3306..865bdbfed1 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2789,59 +2789,6 @@ qemuMonitorCloseFileHandle(qemuMonitorPtr mon, } -/* Add the open file descriptor FD into the non-negative set FDSET. - * If NAME is present, it will be passed along for logging purposes. - * Returns the counterpart fd that qemu received, or -1 on error. */ -int -qemuMonitorAddFd(qemuMonitorPtr mon, int fdset, int fd, const char *name) -{ - VIR_DEBUG("fdset=3D%d, fd=3D%d, name=3D%s", fdset, fd, NULLSTR(name)); - - QEMU_CHECK_MONITOR(mon); - - if (fd < 0 || fdset < 0) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("fd and fdset must be valid")); - return -1; - } - - if (!mon->hasSendFD) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("qemu is not using a unix socket monitor, " - "cannot send fd %s"), NULLSTR(name)); - return -1; - } - - return qemuMonitorJSONAddFd(mon, fdset, fd, name); -} - - -/* Remove one of qemu's fds from the given FDSET, or if FD is - * negative, remove the entire set. Preserve any previous error on - * entry. Returns 0 on success, -1 on error. */ -int -qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd) -{ - int ret =3D -1; - virErrorPtr error; - - VIR_DEBUG("fdset=3D%d, fd=3D%d", fdset, fd); - - error =3D virSaveLastError(); - - QEMU_CHECK_MONITOR_GOTO(mon, cleanup); - - ret =3D qemuMonitorJSONRemoveFd(mon, fdset, fd); - - cleanup: - if (error) { - virSetError(error); - virFreeError(error); - } - return ret; -} - - int qemuMonitorAddNetdev(qemuMonitorPtr mon, const char *netdevstr, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 70000a1c72..7fdda01bdd 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -874,14 +874,12 @@ int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon, int qemuMonitorSendFileHandle(qemuMonitorPtr mon, const char *fdname, int fd); -int qemuMonitorAddFd(qemuMonitorPtr mon, int fdset, int fd, const char *na= me); -/* These two functions preserve previous error and only set their own +/* This function preserves previous error and only set their own * error if no error was set before. */ int qemuMonitorCloseFileHandle(qemuMonitorPtr mon, const char *fdname); -int qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd); int qemuMonitorAddNetdev(qemuMonitorPtr mon, const char *netdevstr, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e4404f0199..ae2b3c1992 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3850,81 +3850,6 @@ int qemuMonitorJSONCloseFileHandle(qemuMonitorPtr mo= n, } -int -qemuMonitorJSONAddFd(qemuMonitorPtr mon, int fdset, int fd, const char *na= me) -{ - int ret; - virJSONValuePtr cmd =3D qemuMonitorJSONMakeCommand("add-fd", - "i:fdset-id", fdset, - "S:opaque", name, - NULL); - virJSONValuePtr reply =3D NULL; - if (!cmd) - return -1; - - ret =3D qemuMonitorJSONCommandWithFd(mon, cmd, fd, &reply); - - if (ret =3D=3D 0) { - /* qemu 1.2 lacks the functionality we need; but we have to - * probe to find that out. Don't log errors in that case. */ - if (STREQ_NULLABLE(name, "/dev/null") && - qemuMonitorJSONHasError(reply, "GenericError")) { - ret =3D -2; - goto cleanup; - } - ret =3D qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT= ); - } - if (ret =3D=3D 0) { - virJSONValuePtr data =3D virJSONValueObjectGetObject(reply, "retur= n"); - - if (virJSONValueObjectGetNumberInt(data, "fd", &ret) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("incomplete return information")); - goto error; - } - } - - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; - - error: - /* Best effort cleanup - kill the entire fdset (even if it has - * earlier successful fd registrations), since we don't know which - * fd qemu got, and don't want to leave the fd leaked in qemu. */ - qemuMonitorJSONRemoveFd(mon, fdset, -1); - ret =3D -1; - goto cleanup; -} - - -int -qemuMonitorJSONRemoveFd(qemuMonitorPtr mon, int fdset, int fd) -{ - int ret =3D -1; - virJSONValuePtr cmd =3D qemuMonitorJSONMakeCommand("remove-fd", - "i:fdset-id", fdset, - fd < 0 ? NULL : "i:fd= ", - fd, NULL); - virJSONValuePtr reply =3D NULL; - if (!cmd) - return -1; - - if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; - - if (qemuMonitorJSONCheckError(cmd, reply) < 0) - goto cleanup; - - ret =3D 0; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; -} - - int qemuMonitorJSONAddNetdev(qemuMonitorPtr mon, const char *netdevstr) { diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 61e64e831b..af4e15594e 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -203,12 +203,9 @@ int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon, int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon, const char *fdname, int fd); -int qemuMonitorJSONAddFd(qemuMonitorPtr mon, int fdset, int fd, - const char *name); int qemuMonitorJSONCloseFileHandle(qemuMonitorPtr mon, const char *fdname); -int qemuMonitorJSONRemoveFd(qemuMonitorPtr mon, int fdset, int fd); int qemuMonitorJSONAddNetdev(qemuMonitorPtr mon, const char *netdevstr); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list