From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674134927; cv=none; d=zohomail.com; s=zohoarc; b=Jkmjncp08uaONuYfweZsBkrQwJTxkkZnqLyiG6zA0xqvvqrn+9++8evvLkrfGaMS8vsAaz+lykrZkeXuMKZc04ggrqr31kIEGTXMp8bfI4Ds45a5ojwzOy9tGzMrYkQz0nIrJ2aAUWxE1z90PGxzHRfyzWyUkLetVuS5S8wHfAM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674134927; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=iKP/Arp2vzPGMe+i69s9qCjqo1U2wTsOz9kT6hZWgbA=; b=CiV5qVZ4V4KH6ha3V4bwUtNwLUs3udD7ecqM73qyi8Gwa0++Xuc8GlWMq/enKTlBt5iuIiRtEFILIHd9KxDWh+Mi6s38GnQ5bqjIY5gX1fQ1E5TJjrXoYlRR1zWCBDPVDdrdEOiqdPjiMLT1hVPmVGBlN4GEMv9aB16ZpxEa7g0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674134927322449.0991367654376; Thu, 19 Jan 2023 05:28:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxO-0005z3-KQ; Thu, 19 Jan 2023 08:27:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx8-0005rV-E5 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx2-0008CG-15 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-189-214f47YwNRy9UESkyE0mpA-1; Thu, 19 Jan 2023 08:27:14 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C04587B2A5; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7009DC15BAD; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4E1E121E675B; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iKP/Arp2vzPGMe+i69s9qCjqo1U2wTsOz9kT6hZWgbA=; b=R6pW5MODaU9g3nPNWwIf47zBSDagDt/tNKepo8exApPn4GmJc1B2EtI9uNlxRC11M2TGez CDMPciVoPzUu+/QOs0wdSKItK8F9102KEimdw9+1fYHQcucInIUX+AvNe8nzuxR1nULLIO eLgdaHENhnbRHd9c734gUHvZzj6ZzPM= X-MC-Unique: 214f47YwNRy9UESkyE0mpA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 01/17] ui: Check numeric part of expire_password argument @time properly Date: Thu, 19 Jan 2023 14:26:57 +0100 Message-Id: <20230119132713.3493556-2-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674134929486100004 When argument @time isn't 'now' or 'never', we parse it as an integer, optionally prefixed with '+'. If parsing fails, we silently assume zero. Report an error and fail instead. While there, use qemu_strtou64() instead of strtoull() so checkpatch.pl won't complain. Aside: encoding numbers in strings is bad QMP practice. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230109190321.1056914-2-armbru@redhat.com> --- monitor/qmp-cmds.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 2932b3f3a5..a1695b6c96 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -201,15 +201,28 @@ void qmp_expire_password(ExpirePasswordOptions *opts,= Error **errp) time_t when; int rc; const char *whenstr =3D opts->time; + const char *numstr =3D NULL; + uint64_t num; =20 if (strcmp(whenstr, "now") =3D=3D 0) { when =3D 0; } else if (strcmp(whenstr, "never") =3D=3D 0) { when =3D TIME_MAX; } else if (whenstr[0] =3D=3D '+') { - when =3D time(NULL) + strtoull(whenstr+1, NULL, 10); + when =3D time(NULL); + numstr =3D whenstr + 1; } else { - when =3D strtoull(whenstr, NULL, 10); + when =3D 0; + numstr =3D whenstr; + } + + if (numstr) { + if (qemu_strtou64(numstr, NULL, 10, &num) < 0) { + error_setg(errp, "Parameter 'time' doesn't take value '%s'", + whenstr); + return; + } + when +=3D num; } =20 if (opts->protocol =3D=3D DISPLAY_PROTOCOL_SPICE) { --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135000; cv=none; d=zohomail.com; s=zohoarc; b=T7HI5SB8pbMqVHZqsSV0FInU7kx5mxY29HUwEjaQwBoG2KjKCArv/AJDZRXyu376qCS2Ux/WqLuRSTB3xiJhw4GUbwskxcyPH4Ed8I3OXy5SKetjcF++JtfPRvS3TWGrKbZRrWJfsu8WEBn+5Arok9u8nT3HPOuoSnixNaTRTQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135000; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=RqkJCEV/eahxdj9mbnQHGMQ7MvST41LpyTbFBOBBMmY=; b=W8L3tGmYNbjwurHaNr4F4YCg/NGC6O2BdICH0d/36Ptiyl3J4hZHWRx6H2Y76ow/CIWjRDIu5xeyUAGjBVf16qqsqZ8Q7WCKMXtRBiGmYSrv+vtGqKnUiXnEmwg4YFY2sZ6q8hkfg97oyxtuqXBh+aKpOof6lv/p7tq9bxYagoY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135000063833.4872920052914; Thu, 19 Jan 2023 05:30:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxJ-0005vn-OK; Thu, 19 Jan 2023 08:27:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx6-0005r5-03 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008By-VO for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-d5huvmTENSyJb1t5pQ1kUQ-1; Thu, 19 Jan 2023 08:27:15 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9CDE8857A88; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 700911121315; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 50D7721E66CD; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RqkJCEV/eahxdj9mbnQHGMQ7MvST41LpyTbFBOBBMmY=; b=HkCAiwy+O1hAs/p0Ibikww51ksLOBar0gEXKSA9FtxtUQjERbiPVvTr7ofthcsc5U6z79Q eG7nLJtXo3lRa1QJx2IG/FslILg0GhkGXI10OJtNHnZlpG3mjDjHutYiReJPMqw6Hhjqoo WAsL1u4h7RHzuvoc0o75c9tqglRSdG0= X-MC-Unique: d5huvmTENSyJb1t5pQ1kUQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 02/17] ui: Fix silent truncation of numeric keys in HMP sendkey Date: Thu, 19 Jan 2023 14:26:58 +0100 Message-Id: <20230119132713.3493556-3-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135000806100001 Keys are int. HMP sendkey assigns them from the value strtoul(), silently truncating values greater than INT_MAX. Fix to reject them. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230109190321.1056914-3-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- monitor/hmp-cmds.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index ed78a87ddd..9947ff0b45 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1549,8 +1549,12 @@ void hmp_sendkey(Monitor *mon, const QDict *qdict) v =3D g_malloc0(sizeof(*v)); =20 if (strstart(keys, "0x", NULL)) { - char *endp; - int value =3D strtoul(keys, &endp, 0); + const char *endp; + int value; + + if (qemu_strtoi(keys, &endp, 0, &value) < 0) { + goto err_out; + } assert(endp <=3D keys + keyname_len); if (endp !=3D keys + keyname_len) { goto err_out; --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135001; cv=none; d=zohomail.com; s=zohoarc; b=VTh0zFbfzM9Utei+10S3jf8ekAKWASetrIAR2JiZa4ug6GtjHS6FF7H3Eou9gJ7uYmPG+wYpF9pdqOPX0c4aEHEgHWlRxz1Y+GDEJCbG1I3MgfQ3lXEYrY0fNAQdkQqWKG3H81ForyVTlu0lj4eqHyaSu0jyaNKPy8YTUwp5p/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135001; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=lbqBCSH8Gnrlm8HFpYQOkBtCIRzmIg2P+/R8bEOLV30=; b=VIQIeKWsGKNX4ger5EnXIAEFIICplkhkxlNuNyrdnKFLgFTJtm/07FE9v5afOP557PGzjbFGReIAnzwRcX1fMQMW+2UF+iknVrZQt/0R2iHYVIymlmCkLbuEwqoksRfZCp5wA7WTIU+dcVqrQis8dz8vS5WeNYg1DeAZBNKOijs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135001262960.4430260743533; Thu, 19 Jan 2023 05:30:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxJ-0005vk-3o; Thu, 19 Jan 2023 08:27:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx7-0005rG-9a for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008CR-Vd for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:37 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-IWv9yn4EM1Gd6zGFrz8zFw-1; Thu, 19 Jan 2023 08:27:15 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9DBCC80D0F2; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FD72492C3F; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5342A21E66F2; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lbqBCSH8Gnrlm8HFpYQOkBtCIRzmIg2P+/R8bEOLV30=; b=CRwh1CJMLxeu3ljd7cWZQE/yroJQlrO7mD5xgrTZE91TurOuZAbpJrzmO4UUezg1kvKzBp iAAT5CJCohwnUxEqIlh7Mb9Q9IEhvMr74pTbK1aBh2s0lZIY/7LZCqcvhgNtQYFnOv3+4n d8l/DuohuefvMLORsD6EpgpLaLpfQb8= X-MC-Unique: IWv9yn4EM1Gd6zGFrz8zFw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 03/17] ui/spice: Require spice-protocol >= 0.14.0 Date: Thu, 19 Jan 2023 14:26:59 +0100 Message-Id: <20230119132713.3493556-4-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135002696100007 Version 0.14.0 is now old enough to have made it into the major distributions: Debian 11: 0.14.3 RHEL-8: 0.14.2 FreeBSD (ports): 0.14.4 Fedora 35: 0.14.0 Ubuntu 20.04: 0.14.0 OpenSUSE Leap 15.3: 0.14.3 Requiring it lets us drop two version checks in ui/vdagent.c. It also enables the next commit. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230109190321.1056914-4-armbru@redhat.com> --- meson.build | 2 +- ui/vdagent.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 58d8cd68a6..c678460cf6 100644 --- a/meson.build +++ b/meson.build @@ -742,7 +742,7 @@ endif =20 spice_protocol =3D not_found if not get_option('spice_protocol').auto() or have_system - spice_protocol =3D dependency('spice-protocol', version: '>=3D0.12.3', + spice_protocol =3D dependency('spice-protocol', version: '>=3D0.14.0', required: get_option('spice_protocol'), method: 'pkg-config', kwargs: static_kwargs) endif diff --git a/ui/vdagent.c b/ui/vdagent.c index 4bf50f0c4d..1f51a78da1 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -87,9 +87,7 @@ static const char *cap_name[] =3D { [VD_AGENT_CAP_MONITORS_CONFIG_POSITION] =3D "monitors-config-pos= ition", [VD_AGENT_CAP_FILE_XFER_DISABLED] =3D "file-xfer-disabled", [VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS] =3D "file-xfer-detailed-= errors", -#if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 0) [VD_AGENT_CAP_GRAPHICS_DEVICE_INFO] =3D "graphics-device-inf= o", -#endif #if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 1) [VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB] =3D "clipboard-no-releas= e-on-regrab", [VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL] =3D "clipboard-grab-seri= al", @@ -112,9 +110,7 @@ static const char *msg_name[] =3D { [VD_AGENT_CLIENT_DISCONNECTED] =3D "client-disconnected", [VD_AGENT_MAX_CLIPBOARD] =3D "max-clipboard", [VD_AGENT_AUDIO_VOLUME_SYNC] =3D "audio-volume-sync", -#if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 0) [VD_AGENT_GRAPHICS_DEVICE_INFO] =3D "graphics-device-info", -#endif }; =20 static const char *sel_name[] =3D { --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674134968; cv=none; d=zohomail.com; s=zohoarc; b=PMaiuxVAxBITjEvG6Hy83UlqgPFOaciKOWTschf67EHYyU6Flvlmsa7PmqvLVm9RdT1tqtqEl7vpq+34XH4lLqHokTdEUpn7AM2cyfsfLuNZU1YsRjxloaFWfFvOlZyt5hI3puS/3fb9Lo7AWLYSCsRzsRRxXynSTSHbqBVBlug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674134968; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=xLm6IsVhlrtzGfoVZhY9vYsYrlTeajP4fhZ9jGQSaUE=; b=nUVkp6jq/Syv4jGytMtSjsmoJCF5ozuc2k8u0YGcKOE36ga1Y6oXkd6jAx9A5TTjxKB/rLn3hpXfDW97Mhf0tRI35XnXVItzPA5FNIcrQnVqk1KSOoCUgO3IaAqiMp/FxyI84Ui0Y4JEE0pW3yCb51d9olwrk6g1HsBymrN73A8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674134968813178.28487074923123; Thu, 19 Jan 2023 05:29:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxJ-0005vm-N9; Thu, 19 Jan 2023 08:27:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx3-0005qJ-89 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUww-0008Bx-Fu for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:32 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-KyYB7tFhNiOeD-TIaqHK2g-1; Thu, 19 Jan 2023 08:27:14 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9D0D91C0A5AE; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7059DC158BA; Thu, 19 Jan 2023 13:27:14 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5595F21E6681; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xLm6IsVhlrtzGfoVZhY9vYsYrlTeajP4fhZ9jGQSaUE=; b=BOxxDZrccCM176Mk1RJX3yefXj2thb0hsVf2ia90in/BRCsnFCNUpjwrXs/7x/EEgTbvep rh2P6WiZo0HTKG1GwBQtzhF1ouxhBqLrNIh8J7tnytp0ZcoEZbEXZ6WiFukZBgjEvg2W9l 8jYWBeYs5SJVNK00tl6KO3UwDGUXU7k= X-MC-Unique: KyYB7tFhNiOeD-TIaqHK2g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 04/17] Revert "hmp: info spice: take out webdav" Date: Thu, 19 Jan 2023 14:27:00 +0100 Message-Id: <20230119132713.3493556-5-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674134971684100003 This reverts commit 7c6044a94e52db8aef9a71d616c7a0914adb71ab. We had to take it out because SPICE_CHANNEL_WEBDAV requires spice-protocol 0.12.7, but we had only 0.12.3. We have 0.14.0 now, so put it back in. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230109190321.1056914-5-armbru@redhat.com> --- monitor/hmp-cmds.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 9947ff0b45..67e39f408e 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -622,12 +622,7 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict) [SPICE_CHANNEL_SMARTCARD] =3D "smartcard", [SPICE_CHANNEL_USBREDIR] =3D "usbredir", [SPICE_CHANNEL_PORT] =3D "port", -#if 0 - /* minimum spice-protocol is 0.12.3, webdav was added in 0.12.7, - * no easy way to #ifdef (SPICE_CHANNEL_* is a enum). Disable - * as quick fix for build failures with older versions. */ [SPICE_CHANNEL_WEBDAV] =3D "webdav", -#endif }; =20 info =3D qmp_query_spice(NULL); --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135240; cv=none; d=zohomail.com; s=zohoarc; b=SB7XXOLvBIVvgKMjZ+yDI+aunHDYf9DbO02R3rYLGJlluJzfRb0Nq+pxz6QeWY5blhURk6+MFqg9SkMvFeL4xyNVrW9NP2PWanchN+0viXDlu/REufzAd+egOU40/kg9KCD00h1ILmMgt9mApJURJXZhpqrQPdO4Am8dWPlcydg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135240; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=sqIA0Zwfg9KS0DMCnZPmiAY8jITEp3ToU6Cv6xAT/U4=; b=DEFA4J0TKMZiNjQDYZVIOgX7gUeJccMbIDyttbpc9/25oNa2W3k/jJCbggq2n2eDHAX2wA+DrcBz0wi+FJ6pkwz6iLFxnRIl7aZ0EAwiT2GA/vjxMsANQkHtP1Pvs61cQV8Saxl/FxYTivnMEI4cZPSTo6dK+JQT9x4S4o6YLgY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135240174584.8323456393649; Thu, 19 Jan 2023 05:34:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxL-0005w9-4k; Thu, 19 Jan 2023 08:27:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx4-0005qR-Pc for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008DB-ST for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:34 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-221-leisXZVTML20lq-CuxzsuA-1; Thu, 19 Jan 2023 08:27:20 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5D7FA101A521; Thu, 19 Jan 2023 13:27:19 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F38740C6EC4; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5803F21E669F; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sqIA0Zwfg9KS0DMCnZPmiAY8jITEp3ToU6Cv6xAT/U4=; b=An/S/yCY7c7/aVkmkuviKqWoibzGzssJAyXOfzsOOuWceQx6pUBnYyVOu+PGK8FC4OOlni rRz3KK/lx2otxnpvUP+Kh+9LzUmCLMdnm1xuwYOOFSWQHZ7Jn9Ic5vQM9yy4aHS7IMzLim v7+Pl4yEDIcyoBzXxWSPzkkQwAR15LQ= X-MC-Unique: leisXZVTML20lq-CuxzsuA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 05/17] ui/spice: Require spice-server >= 0.14.0 Date: Thu, 19 Jan 2023 14:27:01 +0100 Message-Id: <20230119132713.3493556-6-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135240759100005 Version 0.14.0 is now old enough to have made it into the major distributions: Debian 11: 0.14.3 RHEL-8: 0.14.3 FreeBSD (ports): 0.15.0 Fedora 35: 0.15.0 Ubuntu 20.04: 0.14.2 OpenSUSE Leap 15.3: 0.14.3 Requiring it lets us drop a number of version checks. The next commit will clean up some more. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230109190321.1056914-6-armbru@redhat.com> --- meson.build | 2 +- hw/display/qxl.h | 2 -- include/ui/qemu-spice.h | 6 +----- include/ui/spice-display.h | 2 -- chardev/spice.c | 2 -- hw/display/qxl.c | 7 +------ 6 files changed, 3 insertions(+), 18 deletions(-) diff --git a/meson.build b/meson.build index c678460cf6..6d3b665629 100644 --- a/meson.build +++ b/meson.build @@ -748,7 +748,7 @@ if not get_option('spice_protocol').auto() or have_syst= em endif spice =3D not_found if not get_option('spice').auto() or have_system - spice =3D dependency('spice-server', version: '>=3D0.12.5', + spice =3D dependency('spice-server', version: '>=3D0.14.0', required: get_option('spice'), method: 'pkg-config', kwargs: static_kwargs) endif diff --git a/hw/display/qxl.h b/hw/display/qxl.h index cd82c7a6fe..fdac14edad 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -99,9 +99,7 @@ struct PCIQXLDevice { QXLModes *modes; uint32_t rom_size; MemoryRegion rom_bar; -#if SPICE_SERVER_VERSION >=3D 0x000c06 /* release 0.12.6 */ uint16_t max_outputs; -#endif =20 /* vram pci bar */ uint64_t vram_size; diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index 21fe195e18..a7a1890b3f 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -34,13 +34,9 @@ int qemu_spice_add_display_interface(QXLInstance *qxlin,= QemuConsole *con); int qemu_spice_migrate_info(const char *hostname, int port, int tls_port, const char *subject); =20 -#if !defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06) -#define SPICE_NEEDS_SET_MM_TIME 1 -#else #define SPICE_NEEDS_SET_MM_TIME 0 -#endif =20 -#if defined(SPICE_SERVER_VERSION) && (SPICE_SERVER_VERSION >=3D 0x000f00) +#if SPICE_SERVER_VERSION >=3D 0x000f00 /* release 0.15.0 */ #define SPICE_HAS_ATTACHED_WORKER 1 #else #define SPICE_HAS_ATTACHED_WORKER 0 diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index e271e011da..5aa13664d6 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -28,11 +28,9 @@ #include "ui/console.h" =20 #if defined(CONFIG_OPENGL) && defined(CONFIG_GBM) -# if SPICE_SERVER_VERSION >=3D 0x000d01 /* release 0.13.1 */ # define HAVE_SPICE_GL 1 # include "ui/egl-helpers.h" # include "ui/egl-context.h" -# endif #endif =20 #define NUM_MEMSLOTS 8 diff --git a/chardev/spice.c b/chardev/spice.c index bbffef4913..e843d961a7 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -98,9 +98,7 @@ static SpiceCharDeviceInterface vmc_interface =3D { .write =3D vmc_write, .read =3D vmc_read, .event =3D vmc_event, -#if SPICE_SERVER_VERSION >=3D 0x000c06 .flags =3D SPICE_CHAR_DEVICE_NOTIFY_WRITABLE, -#endif }; =20 =20 diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 6772849dec..ddca611804 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -260,8 +260,7 @@ static void qxl_spice_monitors_config_async(PCIQXLDevic= e *qxl, int replay) QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG, 0)); } else { -/* >=3D release 0.12.6, < release 0.14.2 */ -#if SPICE_SERVER_VERSION >=3D 0x000c06 && SPICE_SERVER_VERSION < 0x000e02 +#if SPICE_SERVER_VERSION < 0x000e02 /* release 0.14.2 */ if (qxl->max_outputs) { spice_qxl_set_max_monitors(&qxl->ssd.qxl, qxl->max_outputs); } @@ -1089,12 +1088,10 @@ static int interface_client_monitors_config(QXLInst= ance *sin, return 1; } =20 -#if SPICE_SERVER_VERSION >=3D 0x000c06 /* release 0.12.6 */ /* limit number of outputs based on setting limit */ if (qxl->max_outputs && qxl->max_outputs <=3D max_outputs) { max_outputs =3D qxl->max_outputs; } -#endif =20 config_changed =3D qxl_rom_monitors_config_changed(rom, monitors_config, @@ -2487,9 +2484,7 @@ static Property qxl_properties[] =3D { DEFINE_PROP_UINT32("vram64_size_mb", PCIQXLDevice, vram_size_mb, -= 1), DEFINE_PROP_UINT32("vgamem_mb", PCIQXLDevice, vgamem_size_mb, 16), DEFINE_PROP_INT32("surfaces", PCIQXLDevice, ssd.num_surfaces, 1024= ), -#if SPICE_SERVER_VERSION >=3D 0x000c06 /* release 0.12.6 */ DEFINE_PROP_UINT16("max_outputs", PCIQXLDevice, max_outputs, 0), -#endif DEFINE_PROP_UINT32("xres", PCIQXLDevice, xres, 0), DEFINE_PROP_UINT32("yres", PCIQXLDevice, yres, 0), DEFINE_PROP_BOOL("global-vmstate", PCIQXLDevice, vga.global_vmstat= e, false), --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135031; cv=none; d=zohomail.com; s=zohoarc; b=cnGgXry50hIE4OVCKs6FU2Iknp9wBgFJFSXKvSPGBRm8smMS+F+mM/WfFp4DImG3WMYMCDp2uiu0l2Y3BKS5tg6nJ55bKE8GXuPu0pHp7e+BLVFraHRVuBD8aG5SxReMQUw2wfKRoFTl21NQTON5RwTt+YJoIbCDu+52lsylpps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135031; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=3U8qFoVpDZajtmnzAk6LwJaZOr9j9+fY7LJEaLbAPJ0=; b=cCF/oq9dHX2zRmpsDeSFSEzjWIO8saODt1fnXYni7Y9+9nZGPkBiEkzcDPFY+UzyYfnRC5/FlPjtNNyENUSVGyvZ4Omxzsom7FRosFPcNQN2AH3oo6zE2iyJV9sZoJPrsfrmc7jRDcRM0r0dJVxUY7NGW0gP6ZYVw+oLh59snDE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135031192731.3662020515166; Thu, 19 Jan 2023 05:30:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxN-0005xR-Cr; Thu, 19 Jan 2023 08:27:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx9-0005ry-3Y for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx2-0008Cm-1E for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-237-qmAQQhptPb2H398W_MmpPQ-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C5D4680D0FE; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EA9D1121315; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5A48321E66A4; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3U8qFoVpDZajtmnzAk6LwJaZOr9j9+fY7LJEaLbAPJ0=; b=ifquPJQ9xi0rMJBRT8FLsMkbyHcTE0W2X6MVkCGKtbAZtq+Mv9UPfwJdS02uuMz2PeKRzZ d+ELqigv1RtEhVUCsw1P1Jm8LJuRzyT9GTadqg6sgKLHKTg/radt99ftwXjE3+AjYc0pn+ 4hOtWYyYMHyMMZoRO4UsxaeDICZCNNw= X-MC-Unique: qmAQQhptPb2H398W_MmpPQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 06/17] ui/spice: QXLInterface method set_mm_time() is now dead, drop Date: Thu, 19 Jan 2023 14:27:02 +0100 Message-Id: <20230119132713.3493556-7-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135033250100003 SPICE_NEEDS_SET_MM_TIME is now always off. Bury the dead code. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230109190321.1056914-7-armbru@redhat.com> --- include/ui/qemu-spice.h | 2 -- hw/display/qxl.c | 19 ------------------- ui/spice-display.c | 10 ---------- hw/display/trace-events | 1 - 4 files changed, 32 deletions(-) diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index a7a1890b3f..b7d493742c 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -34,8 +34,6 @@ int qemu_spice_add_display_interface(QXLInstance *qxlin, = QemuConsole *con); int qemu_spice_migrate_info(const char *hostname, int port, int tls_port, const char *subject); =20 -#define SPICE_NEEDS_SET_MM_TIME 0 - #if SPICE_SERVER_VERSION >=3D 0x000f00 /* release 0.15.0 */ #define SPICE_HAS_ATTACHED_WORKER 1 #else diff --git a/hw/display/qxl.c b/hw/display/qxl.c index ddca611804..ec712d3ca2 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -543,22 +543,6 @@ static void interface_set_compression_level(QXLInstanc= e *sin, int level) qxl_rom_set_dirty(qxl); } =20 -#if SPICE_NEEDS_SET_MM_TIME -static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time) -{ - PCIQXLDevice *qxl =3D container_of(sin, PCIQXLDevice, ssd.qxl); - - if (!qemu_spice_display_is_running(&qxl->ssd)) { - return; - } - - trace_qxl_interface_set_mm_time(qxl->id, mm_time); - qxl->shadow_rom.mm_clock =3D cpu_to_le32(mm_time); - qxl->rom->mm_clock =3D cpu_to_le32(mm_time); - qxl_rom_set_dirty(qxl); -} -#endif - static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) { PCIQXLDevice *qxl =3D container_of(sin, PCIQXLDevice, ssd.qxl); @@ -1145,9 +1129,6 @@ static const QXLInterface qxl_interface =3D { #endif =20 .set_compression_level =3D interface_set_compression_level, -#if SPICE_NEEDS_SET_MM_TIME - .set_mm_time =3D interface_set_mm_time, -#endif .get_init_info =3D interface_get_init_info, =20 /* the callbacks below are called from spice server thread context */ diff --git a/ui/spice-display.c b/ui/spice-display.c index 494168e7fe..0616a6982f 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -517,13 +517,6 @@ static void interface_set_compression_level(QXLInstanc= e *sin, int level) /* nothing to do */ } =20 -#if SPICE_NEEDS_SET_MM_TIME -static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time) -{ - /* nothing to do */ -} -#endif - static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) { SimpleSpiceDisplay *ssd =3D container_of(sin, SimpleSpiceDisplay, qxl); @@ -715,9 +708,6 @@ static const QXLInterface dpy_interface =3D { .attache_worker =3D interface_attach_worker, #endif .set_compression_level =3D interface_set_compression_level, -#if SPICE_NEEDS_SET_MM_TIME - .set_mm_time =3D interface_set_mm_time, -#endif .get_init_info =3D interface_get_init_info, =20 /* the callbacks below are called from spice server thread context */ diff --git a/hw/display/trace-events b/hw/display/trace-events index 0c0ffcbe42..2336a0ca15 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -55,7 +55,6 @@ virtio_gpu_fence_ctrl(uint64_t fence, uint32_t type) "fen= ce 0x%" PRIx64 ", type virtio_gpu_fence_resp(uint64_t fence) "fence 0x%" PRIx64 =20 # qxl.c -disable qxl_interface_set_mm_time(int qid, uint32_t mm_time) "%d %d" disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_= t val) "%d %s addr=3D%u val=3D%u" qxl_create_guest_primary(int qid, uint32_t width, uint32_t height, uint64_= t mem, uint32_t format, uint32_t position) "%d %ux%u mem=3D0x%" PRIx64 " %u= ,%u" qxl_create_guest_primary_rest(int qid, int32_t stride, uint32_t type, uint= 32_t flags) "%d %d,%d,%d" --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674134979; cv=none; d=zohomail.com; s=zohoarc; b=NCubENt7isbdQd89pXbmeoaYy/9hSryb5yzY2JNxDj57wAoNXq29ymntFw5L7EvqEl89bLqnUyM1+vuiLCWTph8Phkza4RPA9gVVJ0VbwszMs41hFaA6/E+YlIAvKx1lVm9wRIdkM2KCzX4ZrvWlFC/iL952IHgSLLxd5FkE2xU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674134979; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=wwel3YS4F3wTPZwv9FmPeZTcErlKtj66da6y0ZLWCfc=; b=jZkrq54m7jXS7e49GbuIN7gigL3xFNZWdKrgKcbqcBWRJkoc1GieXjFKg7xsBbwEKh8GyZQ9JwsXd7PvDP96gAgN775QIAWwjklmj8cYlm4TIVgXDeleakyECoxnzmQBkxRaJLBbslUfhU79GsHQ22V8taNTyyF13L5rx270e0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674134979925406.4543443065771; Thu, 19 Jan 2023 05:29:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxN-0005xw-Pl; Thu, 19 Jan 2023 08:27:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx5-0005qY-N9 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008Cg-Ut for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-QNo5gvkUNnux7UQFSdgJiw-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C484C2807D7E; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9ED851121319; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5C9A721E6600; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wwel3YS4F3wTPZwv9FmPeZTcErlKtj66da6y0ZLWCfc=; b=LFf8y40kkTe9COVi8TWVHUIIMuL/PpMKiEZaFmGbP8/5534atLgviitRVJX/ZCnj/O6ula ce6BUPHH6LqdLkSRpKzQ8PskUwyyY8GAlghSFf0a+NPd5Fq7gx111NkS9LWlrzbDeGjbZ7 ax4o+NGmxbu81ppBjm9S5yxiPxkg6qU= X-MC-Unique: QNo5gvkUNnux7UQFSdgJiw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 07/17] ui/spice: Give hmp_info_spice()'s channel_names[] static linkage Date: Thu, 19 Jan 2023 14:27:03 +0100 Message-Id: <20230119132713.3493556-8-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674134980742100005 Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-8-armbru@redhat.com> --- monitor/hmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 67e39f408e..f4d0d031df 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -611,7 +611,7 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict) SpiceChannelList *chan; SpiceInfo *info; const char *channel_name; - const char * const channel_names[] =3D { + static const char *const channel_names[] =3D { [SPICE_CHANNEL_MAIN] =3D "main", [SPICE_CHANNEL_DISPLAY] =3D "display", [SPICE_CHANNEL_INPUTS] =3D "inputs", --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135248; cv=none; d=zohomail.com; s=zohoarc; b=QfeVKbPk6lIkE/INkxCtgS612b6mgyQ7Rtc+IkcmhI1tAcXZ2x9zNP8eeNEt/ctQflT3WcYZ5xPliYQQTDUZoaXW+xoWRX0dbYbYwrcjoThuOul79cmL4CWSVOtK/nW9whvelbT/BrqDaVt5gYdJ35Kriv2Y9Cfy+X4qK75a70Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135248; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=2ZYTmcgw/EHbkkshB3s39lgIVWXj4qASa6NhuHH2EQo=; b=CnZtUEXVUSPJpuM7SlHVkbPaoqprLZHw4Js/467OdtRnz75XjGJl3c4I13mA/r1lXbhd6OcTLV7og6R8qjD90TwZvQBbRBr3ALremdPPnTRRb42/NiQMFw/goS9YyUQVRj/sKaiInt7fY6S59vQ5cXNXlcw2KtALKdOqLH6UTDE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135248547265.64294550241766; Thu, 19 Jan 2023 05:34:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxK-0005vs-RU; Thu, 19 Jan 2023 08:27:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx7-0005rN-PV for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008Cn-W2 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:37 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-237-x40J7nZYPFO7sZWBsCC_jw-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C481A80D0FD; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EE43492C3E; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5F0C421E6602; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2ZYTmcgw/EHbkkshB3s39lgIVWXj4qASa6NhuHH2EQo=; b=i92FtVD9TWhUhuSNHrVT7n3YfpLJPV+NV1Yy2H8ziLYjpJ48U3L7qB+DOb+Z/h/O1HNjhK KtM8lsFGaJ/+E9MjgscickVrn4Ww7Ysk/FrD8WcD1b/pV6jzdalh41vYuR6SNMIUPBEbDt v4CwDTtql/1cr+fO+iTs2p8GBH788OM= X-MC-Unique: x40J7nZYPFO7sZWBsCC_jw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 08/17] ui: Clean up a few things checkpatch.pl would flag later on Date: Thu, 19 Jan 2023 14:27:04 +0100 Message-Id: <20230119132713.3493556-9-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135250579100007 Fix a few style violations so that checkpatch.pl won't complain when I move this code. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-9-armbru@redhat.com> --- monitor/hmp-cmds.c | 7 ++++--- monitor/qmp-cmds.c | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index f4d0d031df..c2249f77a6 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -587,9 +587,10 @@ void hmp_info_vnc(Monitor *mon, const QDict *qdict) hmp_info_vnc_servers(mon, info->server); hmp_info_vnc_clients(mon, info->clients); if (!info->server) { - /* The server entry displays its auth, we only - * need to display in the case of 'reverse' connections - * where there's no server. + /* + * The server entry displays its auth, we only need to + * display in the case of 'reverse' connections where + * there's no server. */ hmp_info_vnc_authcrypt(mon, " ", info->auth, info->has_vencrypt ? &info->vencrypt : NULL= ); diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index a1695b6c96..6d6df86607 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -186,8 +186,10 @@ void qmp_set_password(SetPasswordOptions *opts, Error = **errp) error_setg(errp, QERR_INVALID_PARAMETER, "connected"); return; } - /* Note that setting an empty password will not disable login thro= ugh - * this interface. */ + /* + * Note that setting an empty password will not disable login + * through this interface. + */ rc =3D vnc_display_password(opts->u.vnc.display, opts->password); } =20 @@ -272,12 +274,10 @@ void qmp_add_client(const char *protocol, const char = *fdname, error_setg(errp, "spice failed to add client"); close(fd); } - return; #ifdef CONFIG_VNC } else if (strcmp(protocol, "vnc") =3D=3D 0) { skipauth =3D has_skipauth ? skipauth : false; vnc_display_add_client(NULL, fd, skipauth); - return; #endif #ifdef CONFIG_DBUS_DISPLAY } else if (strcmp(protocol, "@dbus-display") =3D=3D 0) { @@ -289,19 +289,20 @@ void qmp_add_client(const char *protocol, const char = *fdname, close(fd); return; } - return; #endif - } else if ((s =3D qemu_chr_find(protocol)) !=3D NULL) { + } else { + s =3D qemu_chr_find(protocol); + if (!s) { + error_setg(errp, "protocol '%s' is invalid", protocol); + close(fd); + return; + } if (qemu_chr_add_client(s, fd) < 0) { error_setg(errp, "failed to add client"); close(fd); return; } - return; } - - error_setg(errp, "protocol '%s' is invalid", protocol); - close(fd); } =20 =20 --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674134929; cv=none; d=zohomail.com; s=zohoarc; b=YIHhKtNRIjl3Zfd4dHlKykdv8Utd+tu+6d664IK6BmV9ak2zB8/OvgwqAULaT4bP48InHiauLeT1xdXXUz/xBpjIOOaUztrd999xqrEao/vhUtkBsDS+p/DPXhfexcvggvQEqkTbnGvMmYWiTJ++gM6mfSco/si2TMH6Qm/ywVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674134929; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=a/8562241mRXnhonALpPQZE/7v4jC9gJs2LucgygCdY=; b=JrZdyF5Z2TBDpd/8ul7DacNbA4udi/hk3rtvWH+q0dI0cZiuKR/RTk6CTnuBKtnyXQKgXZbE6n/4b89SVl4kEyP18TT7HJClUPQ+vcxb/XEC+rEfXK9N9Xts7NrfyflsbNviidWgQ6KcGxCqAOW3hQVvRTWmi7ZWhzGM3mTjSuY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674134929707476.1987211334175; Thu, 19 Jan 2023 05:28:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxD-0005tM-8A; Thu, 19 Jan 2023 08:27:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx6-0005r6-Eo for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008C8-V1 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:36 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-32-XEAMwS_VPo-YB5sqkx1hFg-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E27A187B2B4; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9ED57C15BAD; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 619ED21E6604; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a/8562241mRXnhonALpPQZE/7v4jC9gJs2LucgygCdY=; b=BZCydLb0aGistnMQ4VY/xhEsvmSo94huaFoxcuBBjiGCFqvk6j9Co15lSYevIZtvOSKczw Q+/3t0N1eEL9VlqwzYBw907yLGqTcmv9Z4oxpsPHmTj0R/RFwIrEuGh4dkBVG3ymJktSpH HWYxXpCIs3WwAWcZJIdlRrw0wrMxzTo= X-MC-Unique: XEAMwS_VPo-YB5sqkx1hFg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/17] ui: Move QMP commands from monitor to new ui/ui-qmp-cmds.c Date: Thu, 19 Jan 2023 14:27:05 +0100 Message-Id: <20230119132713.3493556-10-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674134931511100011 This moves these commands from MAINTAINERS section "QMP" to "Graphics". Command add-client applies to socket character devices in addition to display devices. Move it anyway. Aside: the way @protocol character device IDs and display types is bad design. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-10-armbru@redhat.com> --- monitor/qmp-cmds.c | 118 --------------------------------------- ui/ui-qmp-cmds.c | 136 +++++++++++++++++++++++++++++++++++++++++++++ ui/meson.build | 1 + 3 files changed, 137 insertions(+), 118 deletions(-) create mode 100644 ui/ui-qmp-cmds.c diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 6d6df86607..61449f1b58 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -36,9 +36,7 @@ #include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-stats.h" -#include "qapi/qapi-commands-ui.h" #include "qapi/type-helpers.h" -#include "qapi/qmp/qerror.h" #include "exec/ramlist.h" #include "hw/mem/memory-device.h" #include "hw/acpi/acpi_dev_interface.h" @@ -168,89 +166,6 @@ void qmp_system_wakeup(Error **errp) qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, errp); } =20 -void qmp_set_password(SetPasswordOptions *opts, Error **errp) -{ - int rc; - - if (opts->protocol =3D=3D DISPLAY_PROTOCOL_SPICE) { - if (!qemu_using_spice(errp)) { - return; - } - rc =3D qemu_spice.set_passwd(opts->password, - opts->connected =3D=3D SET_PASSWORD_ACTION_FAIL, - opts->connected =3D=3D SET_PASSWORD_ACTION_DISCONNECT); - } else { - assert(opts->protocol =3D=3D DISPLAY_PROTOCOL_VNC); - if (opts->connected !=3D SET_PASSWORD_ACTION_KEEP) { - /* vnc supports "connected=3Dkeep" only */ - error_setg(errp, QERR_INVALID_PARAMETER, "connected"); - return; - } - /* - * Note that setting an empty password will not disable login - * through this interface. - */ - rc =3D vnc_display_password(opts->u.vnc.display, opts->password); - } - - if (rc !=3D 0) { - error_setg(errp, "Could not set password"); - } -} - -void qmp_expire_password(ExpirePasswordOptions *opts, Error **errp) -{ - time_t when; - int rc; - const char *whenstr =3D opts->time; - const char *numstr =3D NULL; - uint64_t num; - - if (strcmp(whenstr, "now") =3D=3D 0) { - when =3D 0; - } else if (strcmp(whenstr, "never") =3D=3D 0) { - when =3D TIME_MAX; - } else if (whenstr[0] =3D=3D '+') { - when =3D time(NULL); - numstr =3D whenstr + 1; - } else { - when =3D 0; - numstr =3D whenstr; - } - - if (numstr) { - if (qemu_strtou64(numstr, NULL, 10, &num) < 0) { - error_setg(errp, "Parameter 'time' doesn't take value '%s'", - whenstr); - return; - } - when +=3D num; - } - - if (opts->protocol =3D=3D DISPLAY_PROTOCOL_SPICE) { - if (!qemu_using_spice(errp)) { - return; - } - rc =3D qemu_spice.set_pw_expire(when); - } else { - assert(opts->protocol =3D=3D DISPLAY_PROTOCOL_VNC); - rc =3D vnc_display_pw_expire(opts->u.vnc.display, when); - } - - if (rc !=3D 0) { - error_setg(errp, "Could not set password expire time"); - } -} - -#ifdef CONFIG_VNC -void qmp_change_vnc_password(const char *password, Error **errp) -{ - if (vnc_display_password(NULL, password) < 0) { - error_setg(errp, "Could not set password"); - } -} -#endif - void qmp_add_client(const char *protocol, const char *fdname, bool has_skipauth, bool skipauth, bool has_tls, bool t= ls, Error **errp) @@ -305,7 +220,6 @@ void qmp_add_client(const char *protocol, const char *f= dname, } } =20 - MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp) { return qmp_memory_device_list(); @@ -344,38 +258,6 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp) return mem_info; } =20 -void qmp_display_reload(DisplayReloadOptions *arg, Error **errp) -{ - switch (arg->type) { - case DISPLAY_RELOAD_TYPE_VNC: -#ifdef CONFIG_VNC - if (arg->u.vnc.has_tls_certs && arg->u.vnc.tls_certs) { - vnc_display_reload_certs(NULL, errp); - } -#else - error_setg(errp, "vnc is invalid, missing 'CONFIG_VNC'"); -#endif - break; - default: - abort(); - } -} - -void qmp_display_update(DisplayUpdateOptions *arg, Error **errp) -{ - switch (arg->type) { - case DISPLAY_UPDATE_TYPE_VNC: -#ifdef CONFIG_VNC - vnc_display_update(&arg->u.vnc, errp); -#else - error_setg(errp, "vnc is invalid, missing 'CONFIG_VNC'"); -#endif - break; - default: - abort(); - } -} - static int qmp_x_query_rdma_foreach(Object *obj, void *opaque) { RdmaProvider *rdma; diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c new file mode 100644 index 0000000000..c9f92caf1d --- /dev/null +++ b/ui/ui-qmp-cmds.c @@ -0,0 +1,136 @@ +/* + * QMP commands related to UI + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" +#include "qapi/qapi-commands-ui.h" +#include "qapi/qmp/qerror.h" +#include "qemu/cutils.h" +#include "ui/console.h" +#include "ui/qemu-spice.h" + +void qmp_set_password(SetPasswordOptions *opts, Error **errp) +{ + int rc; + + if (opts->protocol =3D=3D DISPLAY_PROTOCOL_SPICE) { + if (!qemu_using_spice(errp)) { + return; + } + rc =3D qemu_spice.set_passwd(opts->password, + opts->connected =3D=3D SET_PASSWORD_ACTION_FAIL, + opts->connected =3D=3D SET_PASSWORD_ACTION_DISCONNECT); + } else { + assert(opts->protocol =3D=3D DISPLAY_PROTOCOL_VNC); + if (opts->connected !=3D SET_PASSWORD_ACTION_KEEP) { + /* vnc supports "connected=3Dkeep" only */ + error_setg(errp, QERR_INVALID_PARAMETER, "connected"); + return; + } + /* + * Note that setting an empty password will not disable login + * through this interface. + */ + rc =3D vnc_display_password(opts->u.vnc.display, opts->password); + } + + if (rc !=3D 0) { + error_setg(errp, "Could not set password"); + } +} + +void qmp_expire_password(ExpirePasswordOptions *opts, Error **errp) +{ + time_t when; + int rc; + const char *whenstr =3D opts->time; + const char *numstr =3D NULL; + uint64_t num; + + if (strcmp(whenstr, "now") =3D=3D 0) { + when =3D 0; + } else if (strcmp(whenstr, "never") =3D=3D 0) { + when =3D TIME_MAX; + } else if (whenstr[0] =3D=3D '+') { + when =3D time(NULL); + numstr =3D whenstr + 1; + } else { + when =3D 0; + numstr =3D whenstr; + } + + if (numstr) { + if (qemu_strtou64(numstr, NULL, 10, &num) < 0) { + error_setg(errp, "Parameter 'time' doesn't take value '%s'", + whenstr); + return; + } + when +=3D num; + } + + if (opts->protocol =3D=3D DISPLAY_PROTOCOL_SPICE) { + if (!qemu_using_spice(errp)) { + return; + } + rc =3D qemu_spice.set_pw_expire(when); + } else { + assert(opts->protocol =3D=3D DISPLAY_PROTOCOL_VNC); + rc =3D vnc_display_pw_expire(opts->u.vnc.display, when); + } + + if (rc !=3D 0) { + error_setg(errp, "Could not set password expire time"); + } +} + +#ifdef CONFIG_VNC +void qmp_change_vnc_password(const char *password, Error **errp) +{ + if (vnc_display_password(NULL, password) < 0) { + error_setg(errp, "Could not set password"); + } +} +#endif + +void qmp_display_reload(DisplayReloadOptions *arg, Error **errp) +{ + switch (arg->type) { + case DISPLAY_RELOAD_TYPE_VNC: +#ifdef CONFIG_VNC + if (arg->u.vnc.has_tls_certs && arg->u.vnc.tls_certs) { + vnc_display_reload_certs(NULL, errp); + } +#else + error_setg(errp, "vnc is invalid, missing 'CONFIG_VNC'"); +#endif + break; + default: + abort(); + } +} + +void qmp_display_update(DisplayUpdateOptions *arg, Error **errp) +{ + switch (arg->type) { + case DISPLAY_UPDATE_TYPE_VNC: +#ifdef CONFIG_VNC + vnc_display_update(&arg->u.vnc, errp); +#else + error_setg(errp, "vnc is invalid, missing 'CONFIG_VNC'"); +#endif + break; + default: + abort(); + } +} diff --git a/ui/meson.build b/ui/meson.build index c1b137bf33..9194ea335b 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -14,6 +14,7 @@ softmmu_ss.add(files( 'kbd-state.c', 'keymaps.c', 'qemu-pixman.c', + 'ui-qmp-cmds.c', 'util.c', )) if dbus_display --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135015; cv=none; d=zohomail.com; s=zohoarc; b=D2WSKmYlrXal7RsiPQxqoTzJ/aBaYLi7R/aTpcWhQEFkCWxfUq4wMkOizg0qGgbSyAXgAu8W99i5rOyWxjxGfxna+XlFzXcrBtlZm35mhTM/JOchvl6H9BQUVKUFTIjXR/aDHyH40KvD7ZEqGYvumlpOn9jZPF/MWwv4dVZkj3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135015; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=dKujExdYj+dmrHMLUfFaBEmV+rJ/Wb9QdcrQYIgEbgk=; b=damshe2+SnA/8F19U60ZPgfF95SzQMKZFTz7FvuWOkN5jslUnNIobquFATkciQRl82123TcB3IGrGY30ds3bCnWk3NC2n+eMplzVJztLTB1UPrvNAjw126zpyvVMOZ07REvJ/07OQ4oBePxwfrRtk04JTQ56jaFaSKl1K4yztwU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167413501577884.39534271516982; Thu, 19 Jan 2023 05:30:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxL-0005x9-Vj; Thu, 19 Jan 2023 08:27:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx4-0005qS-SU for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008Ce-Sj for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:34 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-247-ix-q-WfkNumDG9zp7AiLZQ-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E5F713C1024F; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2F7DC15E7F; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 63FF221E6606; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dKujExdYj+dmrHMLUfFaBEmV+rJ/Wb9QdcrQYIgEbgk=; b=F+xaSzsILCDy9mKwn6YVzfNfQV2sMTzc7kjdXCdAmxuhC8MXdHedAQIPgMIbbElodfP4ul 9FgIBwRMw60hCsn7eHXBJPKwXUl3xo2StjOMIy0KZNiLSJhhK3bAZu4FemTb0FjFXrvzXV XH+6DmaDxIhu2s3UTZqQ5iPLsF6Xmq4= X-MC-Unique: ix-q-WfkNumDG9zp7AiLZQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/17] ui: Factor out qmp_add_client() parts and move to ui/ui-qmp-cmds.c Date: Thu, 19 Jan 2023 14:27:06 +0100 Message-Id: <20230119132713.3493556-11-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135018943100005 Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-11-armbru@redhat.com> --- include/monitor/qmp-helpers.h | 26 ++++++++++++ monitor/qmp-cmds.c | 74 ++++++++++++++++------------------- ui/ui-qmp-cmds.c | 41 +++++++++++++++++++ 3 files changed, 100 insertions(+), 41 deletions(-) create mode 100644 include/monitor/qmp-helpers.h diff --git a/include/monitor/qmp-helpers.h b/include/monitor/qmp-helpers.h new file mode 100644 index 0000000000..4718c63c73 --- /dev/null +++ b/include/monitor/qmp-helpers.h @@ -0,0 +1,26 @@ +/* + * QMP command helpers + * + * Copyright (c) 2022 Red Hat Inc. + * + * Authors: + * Markus Armbruster + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#ifndef MONITOR_QMP_HELPERS_H + +bool qmp_add_client_spice(int fd, bool has_skipauth, bool skipauth, + bool has_tls, bool tls, Error **errp); +#ifdef CONFIG_VNC +bool qmp_add_client_vnc(int fd, bool has_skipauth, bool skipauth, + bool has_tls, bool tls, Error **errp); +#endif +#ifdef CONFIG_DBUS_DISPLAY +bool qmp_add_client_dbus_display(int fd, bool has_skipauth, bool skipauth, + bool has_tls, bool tls, Error **errp); +#endif + +#endif diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 61449f1b58..b5b736761a 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -17,13 +17,11 @@ #include "qemu/cutils.h" #include "qemu/option.h" #include "monitor/monitor.h" +#include "monitor/qmp-helpers.h" #include "sysemu/sysemu.h" #include "qemu/config-file.h" #include "qemu/uuid.h" #include "chardev/char.h" -#include "ui/qemu-spice.h" -#include "ui/console.h" -#include "ui/dbus-display.h" #include "sysemu/kvm.h" #include "sysemu/runstate.h" #include "sysemu/runstate-action.h" @@ -170,54 +168,48 @@ void qmp_add_client(const char *protocol, const char = *fdname, bool has_skipauth, bool skipauth, bool has_tls, bool t= ls, Error **errp) { + static struct { + const char *name; + bool (*add_client)(int fd, bool has_skipauth, bool skipauth, + bool has_tls, bool tls, Error **errp); + } protocol_table[] =3D { + { "spice", qmp_add_client_spice }, +#ifdef CONFIG_VNC + { "vnc", qmp_add_client_vnc }, +#endif +#ifdef CONFIG_DBUS_DISPLAY + { "@dbus-display", qmp_add_client_dbus_display }, +#endif + }; Chardev *s; - int fd; + int fd, i; =20 fd =3D monitor_get_fd(monitor_cur(), fdname, errp); if (fd < 0) { return; } =20 - if (strcmp(protocol, "spice") =3D=3D 0) { - if (!qemu_using_spice(errp)) { - close(fd); - return; - } - skipauth =3D has_skipauth ? skipauth : false; - tls =3D has_tls ? tls : false; - if (qemu_spice.display_add_client(fd, skipauth, tls) < 0) { - error_setg(errp, "spice failed to add client"); - close(fd); - } -#ifdef CONFIG_VNC - } else if (strcmp(protocol, "vnc") =3D=3D 0) { - skipauth =3D has_skipauth ? skipauth : false; - vnc_display_add_client(NULL, fd, skipauth); -#endif -#ifdef CONFIG_DBUS_DISPLAY - } else if (strcmp(protocol, "@dbus-display") =3D=3D 0) { - if (!qemu_using_dbus_display(errp)) { - close(fd); - return; - } - if (!qemu_dbus_display.add_client(fd, errp)) { - close(fd); - return; - } -#endif - } else { - s =3D qemu_chr_find(protocol); - if (!s) { - error_setg(errp, "protocol '%s' is invalid", protocol); - close(fd); - return; - } - if (qemu_chr_add_client(s, fd) < 0) { - error_setg(errp, "failed to add client"); - close(fd); + for (i =3D 0; i < ARRAY_SIZE(protocol_table); i++) { + if (!strcmp(protocol, protocol_table[i].name)) { + if (!protocol_table[i].add_client(fd, has_skipauth, skipauth, + has_tls, tls, errp)) { + close(fd); + } return; } } + + s =3D qemu_chr_find(protocol); + if (!s) { + error_setg(errp, "protocol '%s' is invalid", protocol); + close(fd); + return; + } + if (qemu_chr_add_client(s, fd) < 0) { + error_setg(errp, "failed to add client"); + close(fd); + return; + } } =20 MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp) diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c index c9f92caf1d..dbc4afcd73 100644 --- a/ui/ui-qmp-cmds.c +++ b/ui/ui-qmp-cmds.c @@ -14,10 +14,12 @@ */ =20 #include "qemu/osdep.h" +#include "monitor/qmp-helpers.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qerror.h" #include "qemu/cutils.h" #include "ui/console.h" +#include "ui/dbus-display.h" #include "ui/qemu-spice.h" =20 void qmp_set_password(SetPasswordOptions *opts, Error **errp) @@ -103,6 +105,45 @@ void qmp_change_vnc_password(const char *password, Err= or **errp) } #endif =20 +bool qmp_add_client_spice(int fd, bool has_skipauth, bool skipauth, + bool has_tls, bool tls, Error **errp) +{ + if (!qemu_using_spice(errp)) { + return false; + } + skipauth =3D has_skipauth ? skipauth : false; + tls =3D has_tls ? tls : false; + if (qemu_spice.display_add_client(fd, skipauth, tls) < 0) { + error_setg(errp, "spice failed to add client"); + return false; + } + return true; +} + +#ifdef CONFIG_VNC +bool qmp_add_client_vnc(int fd, bool has_skipauth, bool skipauth, + bool has_tls, bool tls, Error **errp) +{ + skipauth =3D has_skipauth ? skipauth : false; + vnc_display_add_client(NULL, fd, skipauth); + return true; +} +#endif + +#ifdef CONFIG_DBUS_DISPLAY +bool qmp_add_client_dbus_display(int fd, bool has_skipauth, bool skipauth, + bool has_tls, bool tls, Error **errp) +{ + if (!qemu_using_dbus_display(errp)) { + return false; + } + if (!qemu_dbus_display.add_client(fd, errp)) { + return false; + } + return true; +} +#endif + void qmp_display_reload(DisplayReloadOptions *arg, Error **errp) { switch (arg->type) { --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135270; cv=none; d=zohomail.com; s=zohoarc; b=VsBCM0ODmAwf4LsOumhZBg+uube6Cu8gzAT6HoI67MBy+vzLJlHWzQMPQxQla3ZvMshlQT1GxyEg5cjT89sbucOSP2rknG8eup6cBYuS+nXGxoNrMZ3EbsfX5ZPRBkfWnApQxPUbEmzHED8eun7Ql5iTNhTiMt91DlokfTN62b4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135270; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=+6RysFi4qu1hkCar9p0M3Q4S8wQkCKWITye0wzJUUNk=; b=iUS8jggZX+SDme/iqTurdc3ve+BPWqNUq6rugChr1UpRsAW13ID5RIvqm1jOUs5B8fRdnbQ2WMhDWZjCDEhprPCxJpUhtRzw5b+4RFS94iRL84BGYvPPH5kPHDQW4CVByfO4QVemqasQjf9qy57gNTEY5w1DOcWWh0o4KqYwh3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135270580125.98871350734635; Thu, 19 Jan 2023 05:34:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxK-0005vo-4L; Thu, 19 Jan 2023 08:27:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx9-0005s1-Kv for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008CE-W5 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:39 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-nhcSPt0UPt2lWCCUGzJxKQ-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5ADB580D0EB; Thu, 19 Jan 2023 13:27:16 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A993E2026D2A; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 66D7221E6608; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+6RysFi4qu1hkCar9p0M3Q4S8wQkCKWITye0wzJUUNk=; b=b51V7gIE5UONOWfUqpsdVmZykoxg4y2jBv1GMjgPlfsXUNckuSmOCl/FjO5EU0FJM2rBoL eEfHn0dqdMzHLh3MfS0vpwM/fyFlA7o9IFTdcY8VKZeb/GntIkraOt6s9f4+9qJ/y1+thO ifCfXvygIZfSct43upHfcnDIAHSaW4U= X-MC-Unique: nhcSPt0UPt2lWCCUGzJxKQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/17] ui: Move HMP commands from monitor to new ui/ui-hmp-cmds.c Date: Thu, 19 Jan 2023 14:27:07 +0100 Message-Id: <20230119132713.3493556-12-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135271425100001 This moves these commands from MAINTAINERS section "Human Monitor (HMP)" to "Graphics". Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-12-armbru@redhat.com> --- include/monitor/hmp.h | 2 + monitor/hmp-cmds.c | 338 --------------------------------- monitor/misc.c | 66 ------- ui/ui-hmp-cmds.c | 422 ++++++++++++++++++++++++++++++++++++++++++ ui/meson.build | 1 + 5 files changed, 425 insertions(+), 404 deletions(-) create mode 100644 ui/ui-hmp-cmds.c diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 27f86399f7..b228a406f3 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -81,6 +81,8 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict); void hmp_netdev_del(Monitor *mon, const QDict *qdict); void hmp_getfd(Monitor *mon, const QDict *qdict); void hmp_closefd(Monitor *mon, const QDict *qdict); +void hmp_mouse_move(Monitor *mon, const QDict *qdict); +void hmp_mouse_button(Monitor *mon, const QDict *qdict); void hmp_sendkey(Monitor *mon, const QDict *qdict); void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict); void hmp_chardev_add(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index c2249f77a6..c4f161a596 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -51,7 +51,6 @@ #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" #include "qom/object_interfaces.h" -#include "ui/console.h" #include "qemu/cutils.h" #include "qemu/error-report.h" #include "hw/core/cpu.h" @@ -59,10 +58,6 @@ #include "migration/snapshot.h" #include "migration/misc.h" =20 -#ifdef CONFIG_SPICE -#include -#endif - bool hmp_handle_error(Monitor *mon, Error *err) { if (err) { @@ -178,26 +173,6 @@ void hmp_info_chardev(Monitor *mon, const QDict *qdict) qapi_free_ChardevInfoList(char_info); } =20 -void hmp_info_mice(Monitor *mon, const QDict *qdict) -{ - MouseInfoList *mice_list, *mouse; - - mice_list =3D qmp_query_mice(NULL); - if (!mice_list) { - monitor_printf(mon, "No mouse devices connected\n"); - return; - } - - for (mouse =3D mice_list; mouse; mouse =3D mouse->next) { - monitor_printf(mon, "%c Mouse #%" PRId64 ": %s%s\n", - mouse->value->current ? '*' : ' ', - mouse->value->index, mouse->value->name, - mouse->value->absolute ? " (absolute)" : ""); - } - - qapi_free_MouseInfoList(mice_list); -} - void hmp_info_migrate(Monitor *mon, const QDict *qdict) { MigrationInfo *info; @@ -516,168 +491,6 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) qapi_free_MigrationParameters(params); } =20 - -#ifdef CONFIG_VNC -/* Helper for hmp_info_vnc_clients, _servers */ -static void hmp_info_VncBasicInfo(Monitor *mon, VncBasicInfo *info, - const char *name) -{ - monitor_printf(mon, " %s: %s:%s (%s%s)\n", - name, - info->host, - info->service, - NetworkAddressFamily_str(info->family), - info->websocket ? " (Websocket)" : ""); -} - -/* Helper displaying and auth and crypt info */ -static void hmp_info_vnc_authcrypt(Monitor *mon, const char *indent, - VncPrimaryAuth auth, - VncVencryptSubAuth *vencrypt) -{ - monitor_printf(mon, "%sAuth: %s (Sub: %s)\n", indent, - VncPrimaryAuth_str(auth), - vencrypt ? VncVencryptSubAuth_str(*vencrypt) : "none"); -} - -static void hmp_info_vnc_clients(Monitor *mon, VncClientInfoList *client) -{ - while (client) { - VncClientInfo *cinfo =3D client->value; - - hmp_info_VncBasicInfo(mon, qapi_VncClientInfo_base(cinfo), "Client= "); - monitor_printf(mon, " x509_dname: %s\n", - cinfo->x509_dname ?: "none"); - monitor_printf(mon, " sasl_username: %s\n", - cinfo->sasl_username ?: "none"); - - client =3D client->next; - } -} - -static void hmp_info_vnc_servers(Monitor *mon, VncServerInfo2List *server) -{ - while (server) { - VncServerInfo2 *sinfo =3D server->value; - hmp_info_VncBasicInfo(mon, qapi_VncServerInfo2_base(sinfo), "Serve= r"); - hmp_info_vnc_authcrypt(mon, " ", sinfo->auth, - sinfo->has_vencrypt ? &sinfo->vencrypt : NU= LL); - server =3D server->next; - } -} - -void hmp_info_vnc(Monitor *mon, const QDict *qdict) -{ - VncInfo2List *info2l, *info2l_head; - Error *err =3D NULL; - - info2l =3D qmp_query_vnc_servers(&err); - info2l_head =3D info2l; - if (hmp_handle_error(mon, err)) { - return; - } - if (!info2l) { - monitor_printf(mon, "None\n"); - return; - } - - while (info2l) { - VncInfo2 *info =3D info2l->value; - monitor_printf(mon, "%s:\n", info->id); - hmp_info_vnc_servers(mon, info->server); - hmp_info_vnc_clients(mon, info->clients); - if (!info->server) { - /* - * The server entry displays its auth, we only need to - * display in the case of 'reverse' connections where - * there's no server. - */ - hmp_info_vnc_authcrypt(mon, " ", info->auth, - info->has_vencrypt ? &info->vencrypt : NULL= ); - } - if (info->display) { - monitor_printf(mon, " Display: %s\n", info->display); - } - info2l =3D info2l->next; - } - - qapi_free_VncInfo2List(info2l_head); - -} -#endif - -#ifdef CONFIG_SPICE -void hmp_info_spice(Monitor *mon, const QDict *qdict) -{ - SpiceChannelList *chan; - SpiceInfo *info; - const char *channel_name; - static const char *const channel_names[] =3D { - [SPICE_CHANNEL_MAIN] =3D "main", - [SPICE_CHANNEL_DISPLAY] =3D "display", - [SPICE_CHANNEL_INPUTS] =3D "inputs", - [SPICE_CHANNEL_CURSOR] =3D "cursor", - [SPICE_CHANNEL_PLAYBACK] =3D "playback", - [SPICE_CHANNEL_RECORD] =3D "record", - [SPICE_CHANNEL_TUNNEL] =3D "tunnel", - [SPICE_CHANNEL_SMARTCARD] =3D "smartcard", - [SPICE_CHANNEL_USBREDIR] =3D "usbredir", - [SPICE_CHANNEL_PORT] =3D "port", - [SPICE_CHANNEL_WEBDAV] =3D "webdav", - }; - - info =3D qmp_query_spice(NULL); - - if (!info->enabled) { - monitor_printf(mon, "Server: disabled\n"); - goto out; - } - - monitor_printf(mon, "Server:\n"); - if (info->has_port) { - monitor_printf(mon, " address: %s:%" PRId64 "\n", - info->host, info->port); - } - if (info->has_tls_port) { - monitor_printf(mon, " address: %s:%" PRId64 " [tls]\n", - info->host, info->tls_port); - } - monitor_printf(mon, " migrated: %s\n", - info->migrated ? "true" : "false"); - monitor_printf(mon, " auth: %s\n", info->auth); - monitor_printf(mon, " compiled: %s\n", info->compiled_version); - monitor_printf(mon, " mouse-mode: %s\n", - SpiceQueryMouseMode_str(info->mouse_mode)); - - if (!info->has_channels || info->channels =3D=3D NULL) { - monitor_printf(mon, "Channels: none\n"); - } else { - for (chan =3D info->channels; chan; chan =3D chan->next) { - monitor_printf(mon, "Channel:\n"); - monitor_printf(mon, " address: %s:%s%s\n", - chan->value->host, chan->value->port, - chan->value->tls ? " [tls]" : ""); - monitor_printf(mon, " session: %" PRId64 "\n", - chan->value->connection_id); - monitor_printf(mon, " channel: %" PRId64 ":%" PRId64 "\n", - chan->value->channel_type, chan->value->channel= _id); - - channel_name =3D "unknown"; - if (chan->value->channel_type > 0 && - chan->value->channel_type < ARRAY_SIZE(channel_names) && - channel_names[chan->value->channel_type]) { - channel_name =3D channel_names[chan->value->channel_type]; - } - - monitor_printf(mon, " channel name: %s\n", channel_name); - } - } - -out: - qapi_free_SpiceInfo(info); -} -#endif - void hmp_info_balloon(Monitor *mon, const QDict *qdict) { BalloonInfo *info; @@ -1262,69 +1075,6 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const Q= Dict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_set_password(Monitor *mon, const QDict *qdict) -{ - const char *protocol =3D qdict_get_str(qdict, "protocol"); - const char *password =3D qdict_get_str(qdict, "password"); - const char *display =3D qdict_get_try_str(qdict, "display"); - const char *connected =3D qdict_get_try_str(qdict, "connected"); - Error *err =3D NULL; - - SetPasswordOptions opts =3D { - .password =3D (char *)password, - .has_connected =3D !!connected, - }; - - opts.connected =3D qapi_enum_parse(&SetPasswordAction_lookup, connecte= d, - SET_PASSWORD_ACTION_KEEP, &err); - if (err) { - goto out; - } - - opts.protocol =3D qapi_enum_parse(&DisplayProtocol_lookup, protocol, - DISPLAY_PROTOCOL_VNC, &err); - if (err) { - goto out; - } - - if (opts.protocol =3D=3D DISPLAY_PROTOCOL_VNC) { - opts.u.vnc.display =3D (char *)display; - } - - qmp_set_password(&opts, &err); - -out: - hmp_handle_error(mon, err); -} - -void hmp_expire_password(Monitor *mon, const QDict *qdict) -{ - const char *protocol =3D qdict_get_str(qdict, "protocol"); - const char *whenstr =3D qdict_get_str(qdict, "time"); - const char *display =3D qdict_get_try_str(qdict, "display"); - Error *err =3D NULL; - - ExpirePasswordOptions opts =3D { - .time =3D (char *)whenstr, - }; - - opts.protocol =3D qapi_enum_parse(&DisplayProtocol_lookup, protocol, - DISPLAY_PROTOCOL_VNC, &err); - if (err) { - goto out; - } - - if (opts.protocol =3D=3D DISPLAY_PROTOCOL_VNC) { - opts.u.vnc.display =3D (char *)display; - } - - qmp_expire_password(&opts, &err); - -out: - hmp_handle_error(mon, err); -} - - #ifdef CONFIG_VNC static void hmp_change_read_arg(void *opaque, const char *password, void *readline_opaque) @@ -1521,94 +1271,6 @@ void hmp_closefd(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_sendkey(Monitor *mon, const QDict *qdict) -{ - const char *keys =3D qdict_get_str(qdict, "keys"); - KeyValue *v =3D NULL; - KeyValueList *head =3D NULL, **tail =3D &head; - int has_hold_time =3D qdict_haskey(qdict, "hold-time"); - int hold_time =3D qdict_get_try_int(qdict, "hold-time", -1); - Error *err =3D NULL; - const char *separator; - int keyname_len; - - while (1) { - separator =3D qemu_strchrnul(keys, '-'); - keyname_len =3D separator - keys; - - /* Be compatible with old interface, convert user inputted "<" */ - if (keys[0] =3D=3D '<' && keyname_len =3D=3D 1) { - keys =3D "less"; - keyname_len =3D 4; - } - - v =3D g_malloc0(sizeof(*v)); - - if (strstart(keys, "0x", NULL)) { - const char *endp; - int value; - - if (qemu_strtoi(keys, &endp, 0, &value) < 0) { - goto err_out; - } - assert(endp <=3D keys + keyname_len); - if (endp !=3D keys + keyname_len) { - goto err_out; - } - v->type =3D KEY_VALUE_KIND_NUMBER; - v->u.number.data =3D value; - } else { - int idx =3D index_from_key(keys, keyname_len); - if (idx =3D=3D Q_KEY_CODE__MAX) { - goto err_out; - } - v->type =3D KEY_VALUE_KIND_QCODE; - v->u.qcode.data =3D idx; - } - QAPI_LIST_APPEND(tail, v); - v =3D NULL; - - if (!*separator) { - break; - } - keys =3D separator + 1; - } - - qmp_send_key(head, has_hold_time, hold_time, &err); - hmp_handle_error(mon, err); - -out: - qapi_free_KeyValue(v); - qapi_free_KeyValueList(head); - return; - -err_out: - monitor_printf(mon, "invalid parameter: %.*s\n", keyname_len, keys); - goto out; -} - -void coroutine_fn -hmp_screendump(Monitor *mon, const QDict *qdict) -{ - const char *filename =3D qdict_get_str(qdict, "filename"); - const char *id =3D qdict_get_try_str(qdict, "device"); - int64_t head =3D qdict_get_try_int(qdict, "head", 0); - const char *input_format =3D qdict_get_try_str(qdict, "format"); - Error *err =3D NULL; - ImageFormat format; - - format =3D qapi_enum_parse(&ImageFormat_lookup, input_format, - IMAGE_FORMAT_PPM, &err); - if (err) { - goto end; - } - - qmp_screendump(filename, id, id !=3D NULL, head, - input_format !=3D NULL, format, &err); -end: - hmp_handle_error(mon, err); -} - void hmp_chardev_add(Monitor *mon, const QDict *qdict) { const char *args =3D qdict_get_str(qdict, "args"); diff --git a/monitor/misc.c b/monitor/misc.c index bf3f1c67ca..3d68940d28 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -34,7 +34,6 @@ #include "qemu/config-file.h" #include "qemu/ctype.h" #include "ui/console.h" -#include "ui/input.h" #include "audio/audio.h" #include "disas/disas.h" #include "qemu/timer.h" @@ -825,49 +824,6 @@ static void hmp_sum(Monitor *mon, const QDict *qdict) monitor_printf(mon, "%05d\n", sum); } =20 -static int mouse_button_state; - -static void hmp_mouse_move(Monitor *mon, const QDict *qdict) -{ - int dx, dy, dz, button; - const char *dx_str =3D qdict_get_str(qdict, "dx_str"); - const char *dy_str =3D qdict_get_str(qdict, "dy_str"); - const char *dz_str =3D qdict_get_try_str(qdict, "dz_str"); - - dx =3D strtol(dx_str, NULL, 0); - dy =3D strtol(dy_str, NULL, 0); - qemu_input_queue_rel(NULL, INPUT_AXIS_X, dx); - qemu_input_queue_rel(NULL, INPUT_AXIS_Y, dy); - - if (dz_str) { - dz =3D strtol(dz_str, NULL, 0); - if (dz !=3D 0) { - button =3D (dz > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHE= EL_DOWN; - qemu_input_queue_btn(NULL, button, true); - qemu_input_event_sync(); - qemu_input_queue_btn(NULL, button, false); - } - } - qemu_input_event_sync(); -} - -static void hmp_mouse_button(Monitor *mon, const QDict *qdict) -{ - static uint32_t bmap[INPUT_BUTTON__MAX] =3D { - [INPUT_BUTTON_LEFT] =3D MOUSE_EVENT_LBUTTON, - [INPUT_BUTTON_MIDDLE] =3D MOUSE_EVENT_MBUTTON, - [INPUT_BUTTON_RIGHT] =3D MOUSE_EVENT_RBUTTON, - }; - int button_state =3D qdict_get_int(qdict, "button_state"); - - if (mouse_button_state =3D=3D button_state) { - return; - } - qemu_input_update_buttons(NULL, bmap, mouse_button_state, button_state= ); - qemu_input_event_sync(); - mouse_button_state =3D button_state; -} - static void hmp_ioport_read(Monitor *mon, const QDict *qdict) { int size =3D qdict_get_int(qdict, "size"); @@ -1700,28 +1656,6 @@ void object_del_completion(ReadLineState *rs, int nb= _args, const char *str) qapi_free_ObjectPropertyInfoList(start); } =20 -void sendkey_completion(ReadLineState *rs, int nb_args, const char *str) -{ - int i; - char *sep; - size_t len; - - if (nb_args !=3D 2) { - return; - } - sep =3D strrchr(str, '-'); - if (sep) { - str =3D sep + 1; - } - len =3D strlen(str); - readline_set_completion_index(rs, len); - for (i =3D 0; i < Q_KEY_CODE__MAX; i++) { - if (!strncmp(str, QKeyCode_str(i), len)) { - readline_add_completion(rs, QKeyCode_str(i)); - } - } -} - void set_link_completion(ReadLineState *rs, int nb_args, const char *str) { size_t len; diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c new file mode 100644 index 0000000000..4af92f8eaf --- /dev/null +++ b/ui/ui-hmp-cmds.c @@ -0,0 +1,422 @@ +/* + * HMP commands related to UI + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" +#ifdef CONFIG_SPICE +#include +#endif +#include "monitor/hmp.h" +#include "monitor/monitor.h" +#include "qapi/qapi-commands-ui.h" +#include "qapi/qmp/qdict.h" +#include "qemu/cutils.h" +#include "ui/console.h" +#include "ui/input.h" + +static int mouse_button_state; + +void hmp_mouse_move(Monitor *mon, const QDict *qdict) +{ + int dx, dy, dz, button; + const char *dx_str =3D qdict_get_str(qdict, "dx_str"); + const char *dy_str =3D qdict_get_str(qdict, "dy_str"); + const char *dz_str =3D qdict_get_try_str(qdict, "dz_str"); + + dx =3D strtol(dx_str, NULL, 0); + dy =3D strtol(dy_str, NULL, 0); + qemu_input_queue_rel(NULL, INPUT_AXIS_X, dx); + qemu_input_queue_rel(NULL, INPUT_AXIS_Y, dy); + + if (dz_str) { + dz =3D strtol(dz_str, NULL, 0); + if (dz !=3D 0) { + button =3D (dz > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHE= EL_DOWN; + qemu_input_queue_btn(NULL, button, true); + qemu_input_event_sync(); + qemu_input_queue_btn(NULL, button, false); + } + } + qemu_input_event_sync(); +} + +void hmp_mouse_button(Monitor *mon, const QDict *qdict) +{ + static uint32_t bmap[INPUT_BUTTON__MAX] =3D { + [INPUT_BUTTON_LEFT] =3D MOUSE_EVENT_LBUTTON, + [INPUT_BUTTON_MIDDLE] =3D MOUSE_EVENT_MBUTTON, + [INPUT_BUTTON_RIGHT] =3D MOUSE_EVENT_RBUTTON, + }; + int button_state =3D qdict_get_int(qdict, "button_state"); + + if (mouse_button_state =3D=3D button_state) { + return; + } + qemu_input_update_buttons(NULL, bmap, mouse_button_state, button_state= ); + qemu_input_event_sync(); + mouse_button_state =3D button_state; +} + +void hmp_info_mice(Monitor *mon, const QDict *qdict) +{ + MouseInfoList *mice_list, *mouse; + + mice_list =3D qmp_query_mice(NULL); + if (!mice_list) { + monitor_printf(mon, "No mouse devices connected\n"); + return; + } + + for (mouse =3D mice_list; mouse; mouse =3D mouse->next) { + monitor_printf(mon, "%c Mouse #%" PRId64 ": %s%s\n", + mouse->value->current ? '*' : ' ', + mouse->value->index, mouse->value->name, + mouse->value->absolute ? " (absolute)" : ""); + } + + qapi_free_MouseInfoList(mice_list); +} + +#ifdef CONFIG_VNC +/* Helper for hmp_info_vnc_clients, _servers */ +static void hmp_info_VncBasicInfo(Monitor *mon, VncBasicInfo *info, + const char *name) +{ + monitor_printf(mon, " %s: %s:%s (%s%s)\n", + name, + info->host, + info->service, + NetworkAddressFamily_str(info->family), + info->websocket ? " (Websocket)" : ""); +} + +/* Helper displaying and auth and crypt info */ +static void hmp_info_vnc_authcrypt(Monitor *mon, const char *indent, + VncPrimaryAuth auth, + VncVencryptSubAuth *vencrypt) +{ + monitor_printf(mon, "%sAuth: %s (Sub: %s)\n", indent, + VncPrimaryAuth_str(auth), + vencrypt ? VncVencryptSubAuth_str(*vencrypt) : "none"); +} + +static void hmp_info_vnc_clients(Monitor *mon, VncClientInfoList *client) +{ + while (client) { + VncClientInfo *cinfo =3D client->value; + + hmp_info_VncBasicInfo(mon, qapi_VncClientInfo_base(cinfo), "Client= "); + monitor_printf(mon, " x509_dname: %s\n", + cinfo->x509_dname ?: "none"); + monitor_printf(mon, " sasl_username: %s\n", + cinfo->sasl_username ?: "none"); + + client =3D client->next; + } +} + +static void hmp_info_vnc_servers(Monitor *mon, VncServerInfo2List *server) +{ + while (server) { + VncServerInfo2 *sinfo =3D server->value; + hmp_info_VncBasicInfo(mon, qapi_VncServerInfo2_base(sinfo), "Serve= r"); + hmp_info_vnc_authcrypt(mon, " ", sinfo->auth, + sinfo->has_vencrypt ? &sinfo->vencrypt : NU= LL); + server =3D server->next; + } +} + +void hmp_info_vnc(Monitor *mon, const QDict *qdict) +{ + VncInfo2List *info2l, *info2l_head; + Error *err =3D NULL; + + info2l =3D qmp_query_vnc_servers(&err); + info2l_head =3D info2l; + if (hmp_handle_error(mon, err)) { + return; + } + if (!info2l) { + monitor_printf(mon, "None\n"); + return; + } + + while (info2l) { + VncInfo2 *info =3D info2l->value; + monitor_printf(mon, "%s:\n", info->id); + hmp_info_vnc_servers(mon, info->server); + hmp_info_vnc_clients(mon, info->clients); + if (!info->server) { + /* + * The server entry displays its auth, we only need to + * display in the case of 'reverse' connections where + * there's no server. + */ + hmp_info_vnc_authcrypt(mon, " ", info->auth, + info->has_vencrypt ? &info->vencrypt : NULL= ); + } + if (info->display) { + monitor_printf(mon, " Display: %s\n", info->display); + } + info2l =3D info2l->next; + } + + qapi_free_VncInfo2List(info2l_head); + +} +#endif + +#ifdef CONFIG_SPICE +void hmp_info_spice(Monitor *mon, const QDict *qdict) +{ + SpiceChannelList *chan; + SpiceInfo *info; + const char *channel_name; + static const char *const channel_names[] =3D { + [SPICE_CHANNEL_MAIN] =3D "main", + [SPICE_CHANNEL_DISPLAY] =3D "display", + [SPICE_CHANNEL_INPUTS] =3D "inputs", + [SPICE_CHANNEL_CURSOR] =3D "cursor", + [SPICE_CHANNEL_PLAYBACK] =3D "playback", + [SPICE_CHANNEL_RECORD] =3D "record", + [SPICE_CHANNEL_TUNNEL] =3D "tunnel", + [SPICE_CHANNEL_SMARTCARD] =3D "smartcard", + [SPICE_CHANNEL_USBREDIR] =3D "usbredir", + [SPICE_CHANNEL_PORT] =3D "port", + [SPICE_CHANNEL_WEBDAV] =3D "webdav", + }; + + info =3D qmp_query_spice(NULL); + + if (!info->enabled) { + monitor_printf(mon, "Server: disabled\n"); + goto out; + } + + monitor_printf(mon, "Server:\n"); + if (info->has_port) { + monitor_printf(mon, " address: %s:%" PRId64 "\n", + info->host, info->port); + } + if (info->has_tls_port) { + monitor_printf(mon, " address: %s:%" PRId64 " [tls]\n", + info->host, info->tls_port); + } + monitor_printf(mon, " migrated: %s\n", + info->migrated ? "true" : "false"); + monitor_printf(mon, " auth: %s\n", info->auth); + monitor_printf(mon, " compiled: %s\n", info->compiled_version); + monitor_printf(mon, " mouse-mode: %s\n", + SpiceQueryMouseMode_str(info->mouse_mode)); + + if (!info->has_channels || info->channels =3D=3D NULL) { + monitor_printf(mon, "Channels: none\n"); + } else { + for (chan =3D info->channels; chan; chan =3D chan->next) { + monitor_printf(mon, "Channel:\n"); + monitor_printf(mon, " address: %s:%s%s\n", + chan->value->host, chan->value->port, + chan->value->tls ? " [tls]" : ""); + monitor_printf(mon, " session: %" PRId64 "\n", + chan->value->connection_id); + monitor_printf(mon, " channel: %" PRId64 ":%" PRId64 "\n", + chan->value->channel_type, chan->value->channel= _id); + + channel_name =3D "unknown"; + if (chan->value->channel_type > 0 && + chan->value->channel_type < ARRAY_SIZE(channel_names) && + channel_names[chan->value->channel_type]) { + channel_name =3D channel_names[chan->value->channel_type]; + } + + monitor_printf(mon, " channel name: %s\n", channel_name); + } + } + +out: + qapi_free_SpiceInfo(info); +} +#endif + +void hmp_set_password(Monitor *mon, const QDict *qdict) +{ + const char *protocol =3D qdict_get_str(qdict, "protocol"); + const char *password =3D qdict_get_str(qdict, "password"); + const char *display =3D qdict_get_try_str(qdict, "display"); + const char *connected =3D qdict_get_try_str(qdict, "connected"); + Error *err =3D NULL; + + SetPasswordOptions opts =3D { + .password =3D (char *)password, + .has_connected =3D !!connected, + }; + + opts.connected =3D qapi_enum_parse(&SetPasswordAction_lookup, connecte= d, + SET_PASSWORD_ACTION_KEEP, &err); + if (err) { + goto out; + } + + opts.protocol =3D qapi_enum_parse(&DisplayProtocol_lookup, protocol, + DISPLAY_PROTOCOL_VNC, &err); + if (err) { + goto out; + } + + if (opts.protocol =3D=3D DISPLAY_PROTOCOL_VNC) { + opts.u.vnc.display =3D (char *)display; + } + + qmp_set_password(&opts, &err); + +out: + hmp_handle_error(mon, err); +} + +void hmp_expire_password(Monitor *mon, const QDict *qdict) +{ + const char *protocol =3D qdict_get_str(qdict, "protocol"); + const char *whenstr =3D qdict_get_str(qdict, "time"); + const char *display =3D qdict_get_try_str(qdict, "display"); + Error *err =3D NULL; + + ExpirePasswordOptions opts =3D { + .time =3D (char *)whenstr, + }; + + opts.protocol =3D qapi_enum_parse(&DisplayProtocol_lookup, protocol, + DISPLAY_PROTOCOL_VNC, &err); + if (err) { + goto out; + } + + if (opts.protocol =3D=3D DISPLAY_PROTOCOL_VNC) { + opts.u.vnc.display =3D (char *)display; + } + + qmp_expire_password(&opts, &err); + +out: + hmp_handle_error(mon, err); +} + +void hmp_sendkey(Monitor *mon, const QDict *qdict) +{ + const char *keys =3D qdict_get_str(qdict, "keys"); + KeyValue *v =3D NULL; + KeyValueList *head =3D NULL, **tail =3D &head; + int has_hold_time =3D qdict_haskey(qdict, "hold-time"); + int hold_time =3D qdict_get_try_int(qdict, "hold-time", -1); + Error *err =3D NULL; + const char *separator; + int keyname_len; + + while (1) { + separator =3D qemu_strchrnul(keys, '-'); + keyname_len =3D separator - keys; + + /* Be compatible with old interface, convert user inputted "<" */ + if (keys[0] =3D=3D '<' && keyname_len =3D=3D 1) { + keys =3D "less"; + keyname_len =3D 4; + } + + v =3D g_malloc0(sizeof(*v)); + + if (strstart(keys, "0x", NULL)) { + const char *endp; + int value; + + if (qemu_strtoi(keys, &endp, 0, &value) < 0) { + goto err_out; + } + assert(endp <=3D keys + keyname_len); + if (endp !=3D keys + keyname_len) { + goto err_out; + } + v->type =3D KEY_VALUE_KIND_NUMBER; + v->u.number.data =3D value; + } else { + int idx =3D index_from_key(keys, keyname_len); + if (idx =3D=3D Q_KEY_CODE__MAX) { + goto err_out; + } + v->type =3D KEY_VALUE_KIND_QCODE; + v->u.qcode.data =3D idx; + } + QAPI_LIST_APPEND(tail, v); + v =3D NULL; + + if (!*separator) { + break; + } + keys =3D separator + 1; + } + + qmp_send_key(head, has_hold_time, hold_time, &err); + hmp_handle_error(mon, err); + +out: + qapi_free_KeyValue(v); + qapi_free_KeyValueList(head); + return; + +err_out: + monitor_printf(mon, "invalid parameter: %.*s\n", keyname_len, keys); + goto out; +} + +void sendkey_completion(ReadLineState *rs, int nb_args, const char *str) +{ + int i; + char *sep; + size_t len; + + if (nb_args !=3D 2) { + return; + } + sep =3D strrchr(str, '-'); + if (sep) { + str =3D sep + 1; + } + len =3D strlen(str); + readline_set_completion_index(rs, len); + for (i =3D 0; i < Q_KEY_CODE__MAX; i++) { + if (!strncmp(str, QKeyCode_str(i), len)) { + readline_add_completion(rs, QKeyCode_str(i)); + } + } +} + +void coroutine_fn +hmp_screendump(Monitor *mon, const QDict *qdict) +{ + const char *filename =3D qdict_get_str(qdict, "filename"); + const char *id =3D qdict_get_try_str(qdict, "device"); + int64_t head =3D qdict_get_try_int(qdict, "head", 0); + const char *input_format =3D qdict_get_try_str(qdict, "format"); + Error *err =3D NULL; + ImageFormat format; + + format =3D qapi_enum_parse(&ImageFormat_lookup, input_format, + IMAGE_FORMAT_PPM, &err); + if (err) { + goto end; + } + + qmp_screendump(filename, id, id !=3D NULL, head, + input_format !=3D NULL, format, &err); +end: + hmp_handle_error(mon, err); +} diff --git a/ui/meson.build b/ui/meson.build index 9194ea335b..612ea2325b 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -14,6 +14,7 @@ softmmu_ss.add(files( 'kbd-state.c', 'keymaps.c', 'qemu-pixman.c', + 'ui-hmp-cmds.c', 'ui-qmp-cmds.c', 'util.c', )) --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135239; cv=none; d=zohomail.com; s=zohoarc; b=DwiJaxOUUASYEWhTy1ljF/WtRbFdqAdhNL4ptwzHKjJTAhB09XW6Palv6NxNcYgKbY6IrSfniIs2kaxDaUMqV6E3lf7tqnoyPoCmY5Pb36NeclZ1VGXbf+yw+YmRqwho3WY6x+3+MNlGuvL4URBYUKT5bPd7UH1JvoaZf85ogCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135239; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=3rdWxuo5a6P/2x7N/1LEynZ2SkzMEzzvNCAX3G6lNaU=; b=eDEc2ZZvtaBEkw6VCkWQtuNHLsCNa7FApOVXB5GdoTJRWLV2Jq7sHGwvMaVi9XRkZoivQD2PTnZdnIv8Qkwt6IHB7qy3G7xexFImN0fLywPq6k1sQ345T4XsdETDDaPFXw4RIaCZC3yQMTnXrA5lb9btxBRq4yN6Y0RdX30lnC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135239408730.2849156860508; Thu, 19 Jan 2023 05:33:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxN-0005xg-Im; Thu, 19 Jan 2023 08:27:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx8-0005rU-Bf for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx2-0008CO-0o for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-32-oBE2246NM4GUyNvbQWrbww-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E72538A010C; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B10DA2166B2C; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6A31C21E6609; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3rdWxuo5a6P/2x7N/1LEynZ2SkzMEzzvNCAX3G6lNaU=; b=jCU7JKkXSZgo6GS74at4kHkfbJtejnn2lpICE6MIFHvcvrK7R+kK/xoHMWXE0gii4+NUJ9 pO6zCjHnlPtBYBwdkCndgSw/ayhXwTMksrwi90q7IRGeaxvTQno6F1TFKeVSmKQvRGNAsN fOuIoPlQFeHs9klvI1k4Iu/GZV63edA= X-MC-Unique: oBE2246NM4GUyNvbQWrbww-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 12/17] ui: Improve "change vnc" error reporting Date: Thu, 19 Jan 2023 14:27:08 +0100 Message-Id: <20230119132713.3493556-13-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135240762100006 Switch from monitor_printf() to error_setg() and hmp_handle_error(). This makes "this is an error" more obvious both in the source and in the monitor, where hmp_handle_error() prefixes the message with "Error: ". Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-13-armbru@redhat.com> --- monitor/hmp-cmds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index c4f161a596..4340e71c90 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1097,9 +1097,8 @@ void hmp_change(Monitor *mon, const QDict *qdict) #ifdef CONFIG_VNC if (strcmp(device, "vnc") =3D=3D 0) { if (read_only) { - monitor_printf(mon, - "Parameter 'read-only-mode' is invalid for VNC\= n"); - return; + error_setg(&err, "Parameter 'read-only-mode' is invalid for VN= C"); + goto end; } if (strcmp(target, "passwd") =3D=3D 0 || strcmp(target, "password") =3D=3D 0) { @@ -1111,7 +1110,8 @@ void hmp_change(Monitor *mon, const QDict *qdict) qmp_change_vnc_password(arg, &err); } } else { - monitor_printf(mon, "Expected 'password' after 'vnc'\n"); + error_setg(&err, "Expected 'password' after 'vnc'"); + goto end; } } else #endif --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135244; cv=none; d=zohomail.com; s=zohoarc; b=l3Pp05P1ffuhy2CDZJeJ8ymxsPK3wE2+gN8XBESP6LK7jReezf43x+prR4ru2gVlk8hJGVj4mMwj268QBGdbA/dMpah4CWEi39yk1ZM6b08eYfTtW5tz9K/u9g9wCHnnjSxWeKDLhHZoasWVpsPLWJgbZaJV9FNZpQpx9tjLHOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135244; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=mnaC63oq6bRrry64lHXLbLrGjc6PZ21Ed5pkBPRkxFo=; b=Y9kxHDdelh4f9riH5R7wsUrHAEMDD6kjb2VGwCS9BtsjkDMKpllv12MdMRacDBf9KPPqzMcLdThYU8H3XbCkWC94o1LkDRayWYZfs6M3LPX8pewvh1bclsk2eXNYPLcYH2hiVng5fu9LjY7ipx4h7Yn6hhcb+uevXW/Ajt0drzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167413524435474.39830658317476; Thu, 19 Jan 2023 05:34:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxK-0005vq-If; Thu, 19 Jan 2023 08:27:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx7-0005rA-5k for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008CT-Tq for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:36 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-bp9Ew45vNGOySqxjdxnq1A-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0AD8D87B2AA; Thu, 19 Jan 2023 13:27:16 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7F2553AA; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6B85E21E660B; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mnaC63oq6bRrry64lHXLbLrGjc6PZ21Ed5pkBPRkxFo=; b=Tq2jvPQoY8t19TjfIx1LACMSay/dfwp/Wi3YJm++cy4mh308e9eHIA1+5InIQJj/3Sw3uh wN22vJ4uf5UsIcNTNiA9qh6V0ljWSLtApTwOSM0TyRfXWC+kd//JxwA6UZlF3ptj5KQm+z oKPV8bop0NSXNUdgGr1RBEQI5+Juskw= X-MC-Unique: bp9Ew45vNGOySqxjdxnq1A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 13/17] ui: Factor out hmp_change_vnc(), and move to ui/ui-hmp-cmds.c Date: Thu, 19 Jan 2023 14:27:09 +0100 Message-Id: <20230119132713.3493556-14-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135246553100001 Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-14-armbru@redhat.com> --- include/monitor/hmp.h | 5 +++++ monitor/hmp-cmds.c | 30 ++---------------------------- monitor/qmp-cmds.c | 2 +- ui/ui-hmp-cmds.c | 35 ++++++++++++++++++++++++++++++++++- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index b228a406f3..df89eac22a 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -73,6 +73,11 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict= *qdict); void hmp_set_password(Monitor *mon, const QDict *qdict); void hmp_expire_password(Monitor *mon, const QDict *qdict); void hmp_change(Monitor *mon, const QDict *qdict); +#ifdef CONFIG_VNC +void hmp_change_vnc(Monitor *mon, const char *device, const char *target, + const char *arg, const char *read_only, bool force, + Error **errp); +#endif void hmp_migrate(Monitor *mon, const QDict *qdict); void hmp_device_add(Monitor *mon, const QDict *qdict); void hmp_device_del(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 4340e71c90..1dba973092 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -25,7 +25,7 @@ #include "qemu/timer.h" #include "qemu/sockets.h" #include "qemu/help_option.h" -#include "monitor/monitor-internal.h" +#include "monitor/monitor.h" #include "qapi/error.h" #include "qapi/clone-visitor.h" #include "qapi/opts-visitor.h" @@ -41,7 +41,6 @@ #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-commands-stats.h" #include "qapi/qapi-commands-tpm.h" -#include "qapi/qapi-commands-ui.h" #include "qapi/qapi-commands-virtio.h" #include "qapi/qapi-visit-virtio.h" #include "qapi/qapi-visit-net.h" @@ -1075,15 +1074,6 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const Q= Dict *qdict) hmp_handle_error(mon, err); } =20 -#ifdef CONFIG_VNC -static void hmp_change_read_arg(void *opaque, const char *password, - void *readline_opaque) -{ - qmp_change_vnc_password(password, NULL); - monitor_read_command(opaque, 1); -} -#endif - void hmp_change(Monitor *mon, const QDict *qdict) { const char *device =3D qdict_get_str(qdict, "device"); @@ -1096,23 +1086,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) =20 #ifdef CONFIG_VNC if (strcmp(device, "vnc") =3D=3D 0) { - if (read_only) { - error_setg(&err, "Parameter 'read-only-mode' is invalid for VN= C"); - goto end; - } - if (strcmp(target, "passwd") =3D=3D 0 || - strcmp(target, "password") =3D=3D 0) { - if (!arg) { - MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, comm= on); - monitor_read_password(hmp_mon, hmp_change_read_arg, NULL); - return; - } else { - qmp_change_vnc_password(arg, &err); - } - } else { - error_setg(&err, "Expected 'password' after 'vnc'"); - goto end; - } + hmp_change_vnc(mon, device, target, arg, read_only, force, &err); } else #endif { diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index b5b736761a..14f0f78e51 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -168,7 +168,7 @@ void qmp_add_client(const char *protocol, const char *f= dname, bool has_skipauth, bool skipauth, bool has_tls, bool t= ls, Error **errp) { - static struct { + static const struct { const char *name; bool (*add_client)(int fd, bool has_skipauth, bool skipauth, bool has_tls, bool tls, Error **errp); diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 4af92f8eaf..8ae96749f3 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -18,7 +18,8 @@ #include #endif #include "monitor/hmp.h" -#include "monitor/monitor.h" +#include "monitor/monitor-internal.h" +#include "qapi/error.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qdict.h" #include "qemu/cutils.h" @@ -311,6 +312,38 @@ out: hmp_handle_error(mon, err); } =20 +#ifdef CONFIG_VNC +static void hmp_change_read_arg(void *opaque, const char *password, + void *readline_opaque) +{ + qmp_change_vnc_password(password, NULL); + monitor_read_command(opaque, 1); +} + +void hmp_change_vnc(Monitor *mon, const char *device, const char *target, + const char *arg, const char *read_only, bool force, + Error **errp) +{ + if (read_only) { + error_setg(errp, "Parameter 'read-only-mode' is invalid for VNC"); + return; + } + if (strcmp(target, "passwd") =3D=3D 0 || + strcmp(target, "password") =3D=3D 0) { + if (!arg) { + MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); + monitor_read_password(hmp_mon, hmp_change_read_arg, NULL); + return; + } else { + qmp_change_vnc_password(arg, errp); + } + } else { + error_setg(errp, "Expected 'password' after 'vnc'"); + return; + } +} +#endif + void hmp_sendkey(Monitor *mon, const QDict *qdict) { const char *keys =3D qdict_get_str(qdict, "keys"); --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674135260; cv=none; d=zohomail.com; s=zohoarc; b=fdWJY4CdXPyGhD1N4ObyDAY4OR17ecjocKSpGVhQ0O7HkxhAPrZlpui89U0Shsi+s/K3INETgFy4QBiroVuYD02IHweNTG3mIsga6bs+5WWnUx+P0+4y/Y34uPTJYRXpuHFVyuX0d6wTv0Ru89oV7ylpUuwgmX+Rfxu8vzAgrA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674135260; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=cAYjQLYEsFbf31gsDg96+bDpzSiq4ZBQ1TjRYQQfJ8c=; b=d/1dsYDT3aPDMGCe7jrCuuOFi5W8+83DLiuZw3T491Qn6cUeL4HjOZ2MOHkuKWPQCwECmkPs7fNkLajY26sGNfzUOo4SAJqIieNvfpdgxrUpg1UPQtOFjqQLiGGXzdTLhaATT8/L3vo3141NmMQZcW/pQSAjcDwz6o1zYaBcvcM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674135260760950.3680730872829; Thu, 19 Jan 2023 05:34:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxK-0005vp-ET; Thu, 19 Jan 2023 08:27:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx4-0005qO-Fj for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008D4-Su for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:34 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-WXRGh3QQMHuxitPlmCT1Tw-1; Thu, 19 Jan 2023 08:27:16 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE1AC3815F70; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAADAC158BA; Thu, 19 Jan 2023 13:27:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6DFA121E64D9; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cAYjQLYEsFbf31gsDg96+bDpzSiq4ZBQ1TjRYQQfJ8c=; b=hinA393XWEJw6yp5eIA3QGSkEPSswXj3zTgzpclzOoJJNz+JMYsNeGgVox9zYNdZTPJd2W un1rfheMmZ2BSyBt4n2C8aR7EtAsdzDYnI3JTJgYCUhnrKH1eYdaI05hiEaepOTDFplMIe mikGikpUP5/1MuPh+jUwhu578kDvEs8= X-MC-Unique: WXRGh3QQMHuxitPlmCT1Tw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 14/17] ui: Reduce nesting in hmp_change_vnc() slightly Date: Thu, 19 Jan 2023 14:27:10 +0100 Message-Id: <20230119132713.3493556-15-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674135262588100001 Transform if (good) { do stuff } else { handle error } to if (!good) { handle error return; } do stuff Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230109190321.1056914-15-armbru@redhat.com> --- ui/ui-hmp-cmds.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 8ae96749f3..7ca80c8626 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -328,19 +328,16 @@ void hmp_change_vnc(Monitor *mon, const char *device,= const char *target, error_setg(errp, "Parameter 'read-only-mode' is invalid for VNC"); return; } - if (strcmp(target, "passwd") =3D=3D 0 || - strcmp(target, "password") =3D=3D 0) { - if (!arg) { - MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); - monitor_read_password(hmp_mon, hmp_change_read_arg, NULL); - return; - } else { - qmp_change_vnc_password(arg, errp); - } - } else { + if (strcmp(target, "passwd") && strcmp(target, "password")) { error_setg(errp, "Expected 'password' after 'vnc'"); return; } + if (!arg) { + MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); + monitor_read_password(hmp_mon, hmp_change_read_arg, NULL); + } else { + qmp_change_vnc_password(arg, errp); + } } #endif =20 --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674134928; cv=none; d=zohomail.com; s=zohoarc; b=HwTkT49yqJuGRCICngQ9bVyT9snDRRBNzNDmA95jvJOcRFRbtPcCGuaLTZShlNGamBCi+3zR1bNQPXAe6edOsqSSmmJgzQsXlyHQzfFRL5hKNKrwZetVzjzzfyGDzxXQpWG63QvG6AQFtN1jS9JV6XFeTglfZOPj0RyJyRcIt5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674134928; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=UPzt0aa8g/a9haNLJrEi7WzVI5cRolXDHHu66WsrJW4=; b=d5RdycQ1TvcOeeDieYXxt2XEpH5/PJrOP4MtRsouTNpVGj0h3qoZY8SV4nJcyn0zOw2JnEvbls7NUIsZgtfKalhbaO2x4P0dXom135n3s89+C/02nVBZRRaJoH/XFKiy1qbJKMUhNvC16KW7ll0gz6qrnJP1svDIi/dC/EPCuZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674134928596742.6016925106434; Thu, 19 Jan 2023 05:28:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxD-0005tK-7c; Thu, 19 Jan 2023 08:27:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx5-0005qT-Hr for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008Ca-T8 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-17-uJ4iqh9MMyaprpO-E1kwdw-1; Thu, 19 Jan 2023 08:27:17 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D5A93815F70; Thu, 19 Jan 2023 13:27:17 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18C4D492C3C; Thu, 19 Jan 2023 13:27:16 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7042221E5DCF; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UPzt0aa8g/a9haNLJrEi7WzVI5cRolXDHHu66WsrJW4=; b=JgAhpkK3ptNHR5LCEEdOFoa55E8uUxmqpZWAXkiQuictXQGvArxfiXKxM4dMU7EdMghyDs 9uft5rIj/APafGccfUQ6W/oFGejTYwP9d/CVm9rGds9VxcCvzyXdPZ6zIrM9oBqWuwEOBt ucW3wKo86OPO2fleuwrKlcJdwb1IAWE= X-MC-Unique: uJ4iqh9MMyaprpO-E1kwdw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 15/17] ui: Don't check for mode change after mouse_set error Date: Thu, 19 Jan 2023 14:27:11 +0100 Message-Id: <20230119132713.3493556-16-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674134929484100003 hmp_mouse_set() doesn't bail out when it can't find a mouse. Harmless, since qemu_input_check_mode_change() should be a no-op then. Clean it up anyway. Signed-off-by: Markus Armbruster Message-Id: <20230109190321.1056914-16-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/input.c b/ui/input.c index 8f4a87d1d7..d1c7605238 100644 --- a/ui/input.c +++ b/ui/input.c @@ -616,6 +616,7 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict) =20 if (!found) { error_report("Mouse at index '%d' not found", index); + return; } =20 qemu_input_check_mode_change(); --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674134897; cv=none; d=zohomail.com; s=zohoarc; b=JpoFaKNSYHfxb75776XVlqaLHvLUnrKOPAIZpiJCKQJ7GpXgg1Nt2cn81sig5kRbyNXJ1oU6LRMax8sTnrl5QDNqzXncaLltXhjAABcF1jZtcJPxUx3PaUqibdDY+JBE32LCkq/heMwp6W0fT5ewbGCqPDMzJoHxYozDTkSLLZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674134897; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=X8PvGScThlQiFozoB1d+92czy8rP63T4s/aW8kv6IBg=; b=Is7xktv3R2rQsomRxPobnEynf7gY9cAcIikam1KEiDor7XFB2ucgH04Os76uQ5kVdtLwoLrel2Y0s5HHwDT2IDNWTkFTj2wh75lpuFzDbCAe95aCOyidYr0hgdtQZr5xAi7GCbWOosJjghJpMmkcpjGDBRDFuCXk0eGML0VUVzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674134897282883.3653304881389; Thu, 19 Jan 2023 05:28:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxA-0005rn-F4; Thu, 19 Jan 2023 08:27:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx4-0005qQ-Ja for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx1-0008Cq-Sh for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:34 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-515-pIciMTUdMduTzkGRfRCVYg-1; Thu, 19 Jan 2023 08:27:17 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D5EA3C10EE0; Thu, 19 Jan 2023 13:27:17 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAA38492B11; Thu, 19 Jan 2023 13:27:16 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7285121E5DE0; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X8PvGScThlQiFozoB1d+92czy8rP63T4s/aW8kv6IBg=; b=Lu04pvRCC9P6G5SkHsNnj15ZFWeXwc8pDmtyvBL5JRVzKUih7NbuvySvV1B4I1OkagA5FD DoXOHLVbjCXSGPPqwg2hE6wwXFklf4RoxAyvItwpNVENIkNseKIr5QVMcbIzldeD52vyUH yEG2Y/mWZay2ZgP4TlWZysrpMXzbQAA= X-MC-Unique: pIciMTUdMduTzkGRfRCVYg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 16/17] ui: Split hmp_mouse_set() and move the HMP part to ui/ Date: Thu, 19 Jan 2023 14:27:12 +0100 Message-Id: <20230119132713.3493556-17-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674134899418100003 Signed-off-by: Markus Armbruster Message-Id: <20230109190321.1056914-17-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- include/monitor/hmp.h | 1 + include/ui/console.h | 2 +- monitor/misc.c | 1 - ui/input.c | 15 +++++++-------- ui/ui-hmp-cmds.c | 8 ++++++++ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index df89eac22a..8688769a27 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -88,6 +88,7 @@ void hmp_getfd(Monitor *mon, const QDict *qdict); void hmp_closefd(Monitor *mon, const QDict *qdict); void hmp_mouse_move(Monitor *mon, const QDict *qdict); void hmp_mouse_button(Monitor *mon, const QDict *qdict); +void hmp_mouse_set(Monitor *mon, const QDict *qdict); void hmp_sendkey(Monitor *mon, const QDict *qdict); void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict); void hmp_chardev_add(Monitor *mon, const QDict *qdict); diff --git a/include/ui/console.h b/include/ui/console.h index e400ee9fa7..8e6cf782a1 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -65,7 +65,7 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry= ); =20 void kbd_put_ledstate(int ledstate); =20 -void hmp_mouse_set(Monitor *mon, const QDict *qdict); +bool qemu_mouse_set(int index, Error **errp); =20 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx constants) */ diff --git a/monitor/misc.c b/monitor/misc.c index 3d68940d28..50cb9f008b 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -33,7 +33,6 @@ #include "ui/qemu-spice.h" #include "qemu/config-file.h" #include "qemu/ctype.h" -#include "ui/console.h" #include "audio/audio.h" #include "disas/disas.h" #include "qemu/timer.h" diff --git a/ui/input.c b/ui/input.c index d1c7605238..7048810a57 100644 --- a/ui/input.c +++ b/ui/input.c @@ -2,8 +2,6 @@ #include "sysemu/sysemu.h" #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" -#include "qapi/qmp/qdict.h" -#include "qemu/error-report.h" #include "trace.h" #include "ui/input.h" #include "ui/console.h" @@ -594,10 +592,9 @@ MouseInfoList *qmp_query_mice(Error **errp) return mice_list; } =20 -void hmp_mouse_set(Monitor *mon, const QDict *qdict) +bool qemu_mouse_set(int index, Error **errp) { QemuInputHandlerState *s; - int index =3D qdict_get_int(qdict, "index"); int found =3D 0; =20 QTAILQ_FOREACH(s, &handlers, node) { @@ -606,8 +603,9 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict) } if (!(s->handler->mask & (INPUT_EVENT_MASK_REL | INPUT_EVENT_MASK_ABS))) { - error_report("Input device '%s' is not a mouse", s->handler->n= ame); - return; + error_setg(errp, "Input device '%s' is not a mouse", + s->handler->name); + return false; } found =3D 1; qemu_input_handler_activate(s); @@ -615,9 +613,10 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict) } =20 if (!found) { - error_report("Mouse at index '%d' not found", index); - return; + error_setg(errp, "Mouse at index '%d' not found", index); + return false; } =20 qemu_input_check_mode_change(); + return true; } diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 7ca80c8626..5c456ecc02 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -69,6 +69,14 @@ void hmp_mouse_button(Monitor *mon, const QDict *qdict) mouse_button_state =3D button_state; } =20 +void hmp_mouse_set(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + + qemu_mouse_set(qdict_get_int(qdict, "index"), &err); + hmp_handle_error(mon, err); +} + void hmp_info_mice(Monitor *mon, const QDict *qdict) { MouseInfoList *mice_list, *mouse; --=20 2.39.0 From nobody Sat May 18 14:10:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674134976; cv=none; d=zohomail.com; s=zohoarc; b=aK6tJzs0sKO57RwFZMkh0kIdo7ToxM9Oxn74ap28451ugQaZ6kePs24vgY+PytZpcTJW8EvxOZPu2AJkBTtFbw6DD4UxSJjJ7vdj6iXCuEboz8HF8l4cEI4fIeJdKeDx71e7KUpt6HzqvLh46VmiwkPXVmYL0dX96CUCHlgl+ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674134976; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=bIdJEKnEUPp+7AuvAI/G7QVkXj2pzo36gKcXDKriLRo=; b=GguKNwLTF6aZMUjFkX5nqNzmj2s62ArClsWwc34Oic1VXsAbGOFIZgOoUCIf76r3/bsJvsv1bYkCMwErWQo+9WaPf4OjcaA6z3hdNyA2MUIEFVBfA8lxMBoWl5XiHxW/4TjGVHHfcAe1VBOZ9sVXzVvZrmezgCIxkQviKLVXxps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1674134976863433.33124388448243; Thu, 19 Jan 2023 05:29:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIUxL-0005wE-8x; Thu, 19 Jan 2023 08:27:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx8-0005rQ-63 for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIUx2-0008Cs-0X for qemu-devel@nongnu.org; Thu, 19 Jan 2023 08:27:37 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-YboNdd9oNJizPPJo_yQQEA-1; Thu, 19 Jan 2023 08:27:17 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E168280606B; Thu, 19 Jan 2023 13:27:17 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9EA41121319; Thu, 19 Jan 2023 13:27:16 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 74DF421E5A69; Thu, 19 Jan 2023 14:27:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674134840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bIdJEKnEUPp+7AuvAI/G7QVkXj2pzo36gKcXDKriLRo=; b=J5U3xTyNeMVOu4TGXfYewRolsPd3yIoDhDH6HycS+4oS565pZ3+zkcLyL3r8Vw63nNY0vQ cuR11Am+fRBzeOxcuYsDbystWHnR8UNcN87RFox6eErVSTi8Xh2HGH9ubT2dpc7MemAew6 KOGCo5lo/dWOnQGwcAEz2vlo83prFdk= X-MC-Unique: YboNdd9oNJizPPJo_yQQEA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 17/17] ui: Simplify control flow in qemu_mouse_set() Date: Thu, 19 Jan 2023 14:27:13 +0100 Message-Id: <20230119132713.3493556-18-armbru@redhat.com> In-Reply-To: <20230119132713.3493556-1-armbru@redhat.com> References: <20230119132713.3493556-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674134978622100001 Signed-off-by: Markus Armbruster Message-Id: <20230109190321.1056914-18-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/input.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ui/input.c b/ui/input.c index 7048810a57..f2d1e7a3a7 100644 --- a/ui/input.c +++ b/ui/input.c @@ -595,28 +595,26 @@ MouseInfoList *qmp_query_mice(Error **errp) bool qemu_mouse_set(int index, Error **errp) { QemuInputHandlerState *s; - int found =3D 0; =20 QTAILQ_FOREACH(s, &handlers, node) { - if (s->id !=3D index) { - continue; + if (s->id =3D=3D index) { + break; } - if (!(s->handler->mask & (INPUT_EVENT_MASK_REL | - INPUT_EVENT_MASK_ABS))) { - error_setg(errp, "Input device '%s' is not a mouse", - s->handler->name); - return false; - } - found =3D 1; - qemu_input_handler_activate(s); - break; } =20 - if (!found) { + if (!s) { error_setg(errp, "Mouse at index '%d' not found", index); return false; } =20 + if (!(s->handler->mask & (INPUT_EVENT_MASK_REL | + INPUT_EVENT_MASK_ABS))) { + error_setg(errp, "Input device '%s' is not a mouse", + s->handler->name); + return false; + } + + qemu_input_handler_activate(s); qemu_input_check_mode_change(); return true; } --=20 2.39.0