From nobody Tue May 14 07:53:35 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=1671545654; cv=none; d=zohomail.com; s=zohoarc; b=JGyZYueNhpgkibY+BUGlRjWs5O1ffbkUMWZRWUfwgJBVbN7bFsnLXa6GSodYUQ8XH+04JpVHf3j6tABpFPxxOYoeTu1ak9/Mox6tKIDe/caYzTgsRYeUSGp6U8qqCtBB8yDXHJuwJOm+2ONhHxwaurlwxi325XtM+cncP+PLRqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671545654; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/wOWldWggDOZ4kHuElNJ+XnNwGIEx2lMU/r1D8mviZE=; b=eKJa4sQOrQMZlo2SkVZb7LtLnmKwEickXKy9VBW2VDp+TuUEhdKgFsj2OxVLT0XBd3m64xKNset5V9MJiRFK7XSCKcRPL4ipwkkjt/UGcjqw/m+ZwzvTu4FPppUNUQ3DSTg2qHwjAhfQj63of3uToRyCOFR8jZ7o9Eu64ivdAQw= 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 1671545654972642.108539029621; Tue, 20 Dec 2022 06:14:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dCh-00060E-Ff; Tue, 20 Dec 2022 09:02:47 -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 1p7dCZ-0005w7-8q for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02: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 1p7dCV-0002XJ-4J for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02: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-573-tjCn4C2DMdS81b3YscCImw-1; Tue, 20 Dec 2022 09:02:30 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37C598027F8; Tue, 20 Dec 2022 14:02:30 +0000 (UTC) Received: from kostyanf14nb.Dlink (ovpn-192-73.brq.redhat.com [10.40.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E6F314152F4; Tue, 20 Dec 2022 14:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671544954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/wOWldWggDOZ4kHuElNJ+XnNwGIEx2lMU/r1D8mviZE=; b=D0Tap97IdCfCPEJbfUllV3VMJsVnXOPl3C59w7w+Kd2Ccu6J+TViiIPDFB4vZzibV7hVef vDAhTNuKjyIS2I7EhJ+AuPin/N6W+YO4q9ogfKfPnjXWyzOhU/9CeISl2sj4mm6Zi0oFJw ysob7igHsF/NPnvB9Sbn+Rh+tWlex7U= X-MC-Unique: tjCn4C2DMdS81b3YscCImw-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL v3 1/6] qga:/qga-win: adding a empty PCI address creation function Date: Tue, 20 Dec 2022 16:02:20 +0200 Message-Id: <20221220140225.615908-2-kkostiuk@redhat.com> In-Reply-To: <20221220140225.615908-1-kkostiuk@redhat.com> References: <20221220140225.615908-1-kkostiuk@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.7 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=kkostiuk@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: 1671545655460100001 From: Kfir Manor Refactoring code to avoid duplication of creating an empty PCI address code. Signed-off-by: Kfir Manor Reviewed-by: Konstantin Kostiuk Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Konstantin Kostiuk --- qga/commands-win32.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 4df50ea710..bd0f3cccfe 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -596,6 +596,18 @@ static void get_pci_address_for_device(GuestPCIAddress= *pci, } } =20 +static GuestPCIAddress *get_empty_pci_address(void) +{ + GuestPCIAddress *pci =3D NULL; + + pci =3D g_malloc0(sizeof(*pci)); + pci->domain =3D -1; + pci->slot =3D -1; + pci->function =3D -1; + pci->bus =3D -1; + return pci; +} + static GuestPCIAddress *get_pci_info(int number, Error **errp) { HDEVINFO dev_info =3D INVALID_HANDLE_VALUE; @@ -605,13 +617,7 @@ static GuestPCIAddress *get_pci_info(int number, Error= **errp) SP_DEVICE_INTERFACE_DATA dev_iface_data; HANDLE dev_file; int i; - GuestPCIAddress *pci =3D NULL; - - pci =3D g_malloc0(sizeof(*pci)); - pci->domain =3D -1; - pci->slot =3D -1; - pci->function =3D -1; - pci->bus =3D -1; + GuestPCIAddress *pci =3D get_empty_pci_address(); =20 dev_info =3D SetupDiGetClassDevs(&GUID_DEVINTERFACE_DISK, 0, 0, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); --=20 2.25.1 From nobody Tue May 14 07:53:35 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=1671545007; cv=none; d=zohomail.com; s=zohoarc; b=HT6/btr/sdD3v6lI8l2vYa9AkhZ/4Bw/jIb68onEGP8XrNdGlwdnhlzB2ZY7xNicfRLM5tT97fLlkQuXn/aBfewPDermE1aIR2BjN2CHDR1F6vdb6GinDiEXCM9ey9RACPRNCG1GQ3fXW/vivoTzb4s5VtXvPmD4jO7AvXFAQ4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671545007; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RoglSNHRStA7iusp7Ok/OG6eExg60+j4uM7vv5xGEmg=; b=aVgx00/ToREPlRMEpdNtCP2ieE8XHLpZEWV/YpkR3q7JsUfcVYD3IPzYuEGG935HIF6YUd62RVmaDn7VnJcIsj9+mNTtvfUu9xnTesNS4rhGCVcM6zv4hS+6OsZWKPBGQ9CL39ymZcMcDrs8SEuOxqBHaitV1L8GbU6Zol+3JYA= 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 1671545007455421.06703815837375; Tue, 20 Dec 2022 06:03:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dCf-0005yz-Pl; Tue, 20 Dec 2022 09:02:45 -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 1p7dCW-0005st-JC for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02: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 1p7dCU-0002XA-TI for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02: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-557-xzn1V_uGP82pprkRM7owiw-1; Tue, 20 Dec 2022 09:02:31 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B64B858F0E; Tue, 20 Dec 2022 14:02:31 +0000 (UTC) Received: from kostyanf14nb.Dlink (ovpn-192-73.brq.redhat.com [10.40.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97F0714152F6; Tue, 20 Dec 2022 14:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671544953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RoglSNHRStA7iusp7Ok/OG6eExg60+j4uM7vv5xGEmg=; b=PWW2om8J9qUhJZSPmnl5BMc6l1JJ+Vvxqek4MrArVwvSRrdSIJOanaWb/5E3wfOPKUqzr5 c4hp2RuqQe8h5VGxeeUry0VqROEjA2Bef8GAHJXTQyLztmjqplr+iWrqYXgiY34oipUZST ZCxjpCHCivIRY/6zobEJjeQQsLiUx6c= X-MC-Unique: xzn1V_uGP82pprkRM7owiw-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL v3 2/6] qga:/qga-win: skip getting pci info for USB disks Date: Tue, 20 Dec 2022 16:02:21 +0200 Message-Id: <20221220140225.615908-3-kkostiuk@redhat.com> In-Reply-To: <20221220140225.615908-1-kkostiuk@redhat.com> References: <20221220140225.615908-1-kkostiuk@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.7 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=kkostiuk@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: 1671545010448100001 From: Kfir Manor Skip getting PCI info from disks type USB and give them an empty PCI addres= s instead. Signed-off-by: Kfir Manor Reviewed-by: Konstantin Kostiuk Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Konstantin Kostiuk --- qga/commands-win32.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index bd0f3cccfe..b5fee6a2cd 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -874,10 +874,14 @@ static void get_single_disk_info(int disk_number, * if that doesn't hold since that suggests some other unexpected * breakage */ - disk->pci_controller =3D get_pci_info(disk_number, &local_err); - if (local_err) { - error_propagate(errp, local_err); - goto err_close; + if (disk->bus_type =3D=3D GUEST_DISK_BUS_TYPE_USB) { + disk->pci_controller =3D get_empty_pci_address(); + } else { + disk->pci_controller =3D get_pci_info(disk_number, &local_err); + if (local_err) { + error_propagate(errp, local_err); + goto err_close; + } } if (disk->bus_type =3D=3D GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type =3D=3D GUEST_DISK_BUS_TYPE_IDE --=20 2.25.1 From nobody Tue May 14 07:53:35 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=1671545319; cv=none; d=zohomail.com; s=zohoarc; b=ctSwVwE5UoMDvFAECPW6DaNMSGk95AI3Ob0Bfwpy/VM6aZN/JBwSCpORmrfStTyMLrqyE47jMwz9fePokymjcWBRxWokuceMgZHWdrRCiMwfmTYFzEVdYsEzIK1ghMvT/9N6DzY83drkAr/COQAu2mOcGgx5w6bpbrxUnzPU570= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671545319; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VBNyMX+OlU77yDDpbKs/c0cqbxMQdPVs0W/gqD71INU=; b=haH3RFvI7+2pril6Plf8ZknaQEXJvVz4JNSKLZ1HFEFT39+aQJ05Uh/+VN1anJLzdbC/iEctedWK2KBlkVglLjrJ1nfD926QQyPw+mqOAnkmIZN7fF/a21jZ5OA13921KV3MBAj+TfR5nLPUQK37d4YoKhdI9CoASUYA2fPLiTo= 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 1671545319011853.8722347163845; Tue, 20 Dec 2022 06:08:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dCe-0005yN-Dk; Tue, 20 Dec 2022 09:02:44 -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 1p7dCa-0005wp-NS for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02:41 -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 1p7dCZ-0002Xl-1r for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02:40 -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-113-Q5QpbhxYNF-gJ-6qdBGayA-1; Tue, 20 Dec 2022 09:02:34 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D3A741C09C8C; Tue, 20 Dec 2022 14:02:32 +0000 (UTC) Received: from kostyanf14nb.Dlink (ovpn-192-73.brq.redhat.com [10.40.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8FC914152F4; Tue, 20 Dec 2022 14:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671544957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VBNyMX+OlU77yDDpbKs/c0cqbxMQdPVs0W/gqD71INU=; b=elbLGfUbxfwhcqbVHzr/YbqMeqiatjEvXqW4Tr5LgOswZ/8DH8l9yzFphXIksy4UDmcNf0 WeySZoaLOXJsvXQpp9V04JKlycSM8J9rfXgcAX8FRjgO9BJQg4aybJmtTqM6fV7Db7C0hJ 4CVM4/nLUG8HqevaGyBWJ8CKl8SNz6o= X-MC-Unique: Q5QpbhxYNF-gJ-6qdBGayA-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL v3 3/6] qga: Add initial OpenBSD and NetBSD support Date: Tue, 20 Dec 2022 16:02:22 +0200 Message-Id: <20221220140225.615908-4-kkostiuk@redhat.com> In-Reply-To: <20221220140225.615908-1-kkostiuk@redhat.com> References: <20221220140225.615908-1-kkostiuk@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.7 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=kkostiuk@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: 1671545319320100001 From: Brad Smith qga: Add initial OpenBSD and NetBSD support Signed-off-by: Brad Smith Reviewed-by: Konstantin Kostiuk Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Konstantin Kostiuk --- meson.build | 2 +- qga/commands-bsd.c | 5 +++++ qga/commands-posix.c | 9 +++++++-- qga/main.c | 6 +++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 5c6b5a1c75..4c6f8a674a 100644 --- a/meson.build +++ b/meson.build @@ -75,7 +75,7 @@ have_tools =3D get_option('tools') \ .allowed() have_ga =3D get_option('guest_agent') \ .disable_auto_if(not have_system and not have_tools) \ - .require(targetos in ['sunos', 'linux', 'windows', 'freebsd'], + .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', = 'openbsd'], error_message: 'unsupported OS for QEMU guest agent') \ .allowed() have_block =3D have_system or have_tools diff --git a/qga/commands-bsd.c b/qga/commands-bsd.c index 15cade2d4c..17bddda1cf 100644 --- a/qga/commands-bsd.c +++ b/qga/commands-bsd.c @@ -21,7 +21,12 @@ #include #include #include +#if defined(__NetBSD__) || defined(__OpenBSD__) +#include +#include +#else #include +#endif #include =20 #if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 1a28326ec7..b19b9c5d18 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -45,7 +45,12 @@ #include #include #include +#if defined(__NetBSD__) || defined(__OpenBSD__) +#include +#include +#else #include +#endif #include #ifdef CONFIG_SOLARIS #include @@ -2872,7 +2877,7 @@ static int guest_get_network_stats(const char *name, return -1; } =20 -#ifndef __FreeBSD__ +#ifndef CONFIG_BSD /* * Fill "buf" with MAC address by ifaddrs. Pointer buf must point to a * buffer with ETHER_ADDR_LEN length at least. @@ -2921,7 +2926,7 @@ bool guest_get_hw_addr(struct ifaddrs *ifa, unsigned = char *buf, close(sock); return true; } -#endif /* __FreeBSD__ */ +#endif /* CONFIG_BSD */ =20 /* * Build information about guest interfaces diff --git a/qga/main.c b/qga/main.c index b3580508fa..0865c992f0 100644 --- a/qga/main.c +++ b/qga/main.c @@ -40,11 +40,11 @@ #include "commands-common.h" =20 #ifndef _WIN32 -#ifdef __FreeBSD__ +#ifdef CONFIG_BSD #define QGA_VIRTIO_PATH_DEFAULT "/dev/vtcon/org.qemu.guest_agent.0" -#else /* __FreeBSD__ */ +#else /* CONFIG_BSD */ #define QGA_VIRTIO_PATH_DEFAULT "/dev/virtio-ports/org.qemu.guest_agent.0" -#endif /* __FreeBSD__ */ +#endif /* CONFIG_BSD */ #define QGA_SERIAL_PATH_DEFAULT "/dev/ttyS0" #define QGA_STATE_RELATIVE_DIR "run" #else --=20 2.25.1 From nobody Tue May 14 07:53:35 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=1671545122; cv=none; d=zohomail.com; s=zohoarc; b=M99XOVV/n4kiqTni02g41yt/IYEV3UYDASWHIVtt60SWC176AYYyeY34eanyLLsUAPtzil222o/UiZYmOAqsTP0I8XsJ4MV6otk6FXLJbExxWwPRF6ajoO+kQRmiAjRER5MCWnmmGKrRMMo8HAEYziSGqhwluVdf++KjlM4Je/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671545122; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XFGCXiBXq7GXip/TxdUl+YDCxJBaCOEFes4FOAmMt+w=; b=XutBxxchg4P3c5YdK+5zG4hW71oOEZY5mWfGB8VP0wAfCoMzJGiHANWUqB3lFouRB9kERWBetoZ7qp64VWTar4fcaueQ62nUZUn8ceahH845FDF+7R55jA/QSyAjEK2MJU4d1qFHZ+atJfg3nlvVCCC9NQty/V1+rWM9EFhxCNg= 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 1671545122836868.7439062171654; Tue, 20 Dec 2022 06:05:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dCq-000631-K6; Tue, 20 Dec 2022 09:02:56 -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 1p7dCZ-0005w6-8q for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02: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 1p7dCX-0002XY-5N for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02: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-548-c_rmyUk3O4iJlP3xt1oprA-1; Tue, 20 Dec 2022 09:02:34 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2539A100F903; Tue, 20 Dec 2022 14:02:34 +0000 (UTC) Received: from kostyanf14nb.Dlink (ovpn-192-73.brq.redhat.com [10.40.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D23A14152F4; Tue, 20 Dec 2022 14:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671544956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XFGCXiBXq7GXip/TxdUl+YDCxJBaCOEFes4FOAmMt+w=; b=d1lPKeGPTZiL+B9mHFyzBd26xEwGBjk1tzVoxwLfV2kESAGVn8Vv8fhE4UQozgsECHX2tx lWfa05ZM17hCErlQr+4JG7esIKkq653f76ReapczhpU2GOq4nWGpF2vxIVFFPYZTivryp3 G47ZCrFZ/Oa5rqma04OAalEzNOqnv5M= X-MC-Unique: c_rmyUk3O4iJlP3xt1oprA-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL v3 4/6] qga-win: add logging to Windows event log Date: Tue, 20 Dec 2022 16:02:23 +0200 Message-Id: <20221220140225.615908-5-kkostiuk@redhat.com> In-Reply-To: <20221220140225.615908-1-kkostiuk@redhat.com> References: <20221220140225.615908-1-kkostiuk@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.7 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=kkostiuk@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: 1671545124212100003 From: Andrey Drobyshev This commit allows QGA to write to Windows event log using Win32 API's ReportEvent() [1], much like syslog() under *nix guests. In order to generate log message definitions we use a very basic message text file [2], so that every QGA's message gets ID 1. The tools "windmc" and "windres" respectively are used to generate ".rc" file and COFF object file, and then the COFF file is linked into qemu-ga.exe. [1] https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-= reporteventa [2] https://learn.microsoft.com/en-us/windows/win32/eventlog/message-text-f= iles Originally-by: Yuri Pudgorodskiy Signed-off-by: Andrey Drobyshev Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Konstantin Kostiuk Tested-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- configure | 3 +++ qga/installer/qemu-ga.wxs | 5 +++++ qga/main.c | 16 +++++++++++++--- qga/meson.build | 19 ++++++++++++++++++- qga/messages-win32.mc | 9 +++++++++ 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 qga/messages-win32.mc diff --git a/configure b/configure index 26c7bc5154..789a4f6cc9 100755 --- a/configure +++ b/configure @@ -372,6 +372,7 @@ smbd=3D"$SMBD" strip=3D"${STRIP-${cross_prefix}strip}" widl=3D"${WIDL-${cross_prefix}widl}" windres=3D"${WINDRES-${cross_prefix}windres}" +windmc=3D"${WINDMC-${cross_prefix}windmc}" pkg_config_exe=3D"${PKG_CONFIG-${cross_prefix}pkg-config}" query_pkg_config() { "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" @@ -2561,6 +2562,7 @@ if test "$skip_meson" =3D no; then echo "strip =3D [$(meson_quote $strip)]" >> $cross echo "widl =3D [$(meson_quote $widl)]" >> $cross echo "windres =3D [$(meson_quote $windres)]" >> $cross + echo "windmc =3D [$(meson_quote $windmc)]" >> $cross if test "$cross_compile" =3D "yes"; then cross_arg=3D"--cross-file config-meson.cross" echo "[host_machine]" >> $cross @@ -2667,6 +2669,7 @@ preserve_env SMBD preserve_env STRIP preserve_env WIDL preserve_env WINDRES +preserve_env WINDMC =20 printf "exec" >>config.status for i in "$0" "$@"; do diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index 813d1c6ca6..e344c38e74 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -110,6 +110,11 @@ + + + + diff --git a/qga/main.c b/qga/main.c index 0865c992f0..1463a1c170 100644 --- a/qga/main.c +++ b/qga/main.c @@ -83,6 +83,7 @@ struct GAState { #ifdef _WIN32 GAService service; HANDLE wakeup_event; + HANDLE event_log; #endif bool delimit_response; bool frozen; @@ -324,13 +325,14 @@ static void ga_log(const gchar *domain, GLogLevelFlag= s level, } =20 level &=3D G_LOG_LEVEL_MASK; -#ifndef _WIN32 if (g_strcmp0(domain, "syslog") =3D=3D 0) { +#ifndef _WIN32 syslog(LOG_INFO, "%s: %s", level_str, msg); - } else if (level & s->log_level) { #else - if (level & s->log_level) { + ReportEvent(s->event_log, EVENTLOG_INFORMATION_TYPE, + 0, 1, NULL, 1, 0, &msg, NULL); #endif + } else if (level & s->log_level) { g_autoptr(GDateTime) now =3D g_date_time_new_now_utc(); g_autofree char *nowstr =3D g_date_time_format(now, "%s.%f"); fprintf(s->log_file, "%s: %s: %s\n", nowstr, level_str, msg); @@ -1286,6 +1288,13 @@ static GAState *initialize_agent(GAConfig *config, i= nt socket_activation) g_debug("Guest agent version %s started", QEMU_FULL_VERSION); =20 #ifdef _WIN32 + s->event_log =3D RegisterEventSource(NULL, "qemu-ga"); + if (!s->event_log) { + g_autofree gchar *errmsg =3D g_win32_error_message(GetLastError()); + g_critical("unable to register event source: %s", errmsg); + return NULL; + } + /* On win32 the state directory is application specific (be it the def= ault * or a user override). We got past the command line parsing; let's cr= eate * the directory (with any intermediate directories). If we run into an @@ -1377,6 +1386,7 @@ static void cleanup_agent(GAState *s) { #ifdef _WIN32 CloseHandle(s->wakeup_event); + CloseHandle(s->event_log); #endif if (s->command_state) { ga_command_state_cleanup_all(s->command_state); diff --git a/qga/meson.build b/qga/meson.build index 3cfb9166e5..1ff159edc1 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -98,7 +98,24 @@ if targetos =3D=3D 'windows' endif endif =20 -qga =3D executable('qemu-ga', qga_ss.sources(), +qga_objs =3D [] +if targetos =3D=3D 'windows' + windmc =3D find_program('windmc', required: true) + windres =3D find_program('windres', required: true) + + msgrc =3D custom_target('messages-win32.rc', + input: 'messages-win32.mc', + output: ['messages-win32.rc', 'MSG00409.bin', 'mes= sages-win32.h'], + command: [windmc, '-h', '@OUTDIR@', '-r', '@OUTDIR= @', '@INPUT@']) + msgobj =3D custom_target('messages-win32.o', + input: msgrc[0], + output: 'messages-win32.o', + command: [windres, '-I', '@OUTDIR@', '-o', '@OUTP= UT@', '@INPUT@']) + + qga_objs =3D [msgobj] +endif + +qga =3D executable('qemu-ga', qga_ss.sources() + qga_objs, link_args: qga_libs, dependencies: [qemuutil, libudev], install: true) diff --git a/qga/messages-win32.mc b/qga/messages-win32.mc new file mode 100644 index 0000000000..e21019cebe --- /dev/null +++ b/qga/messages-win32.mc @@ -0,0 +1,9 @@ +LanguageNames=3D( + English=3D0x409:MSG00409 +) + +MessageId=3D1 +SymbolicName=3DQEMU_GA_EVENTLOG_GENERAL +Language=3DEnglish +%1 +. --=20 2.25.1 From nobody Tue May 14 07:53:35 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=1671545369; cv=none; d=zohomail.com; s=zohoarc; b=ROcdkQy/p4XuhER7FAZg5YOCOTEnc7cYJ1aM+gyr25B5rRgSQi4SFrYzIrC2ijKpEnqohNJRA0yg3H2dGAINra21rQlM9PyO8U+J54H3OKOOS0xVPq8KFqfH/pOvZQtqoTT/oqW/tAUx1FJbzlXp54r+0+mdwb07Jpmk4Qc9z/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671545369; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EiqpLgMdKm5wDoDtt0Ai72IZcAFTUwTuIR+jsui5eJE=; b=FbAe7DmaGhThMnk4JWlfy6fp0dkBovSGCPq+zaaM93WECvpKkxpD9YLtyO04vTOJl3TIH6k106aso3YLZFk+qj+fErhAbUTYbNqNuQnZj//WVo7VKQEnT2GmslscwcoDal8cBqu/EfFXjNZpeV6dqfVKhwGnj6mV2NOPh4PJI1g= 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 1671545369786866.3574148056438; Tue, 20 Dec 2022 06:09:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dCs-00063g-IN; Tue, 20 Dec 2022 09:02:58 -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 1p7dCf-0005z8-Ae for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02:45 -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 1p7dCd-0002Yb-HY for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02:44 -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-639-YQPPFxisOsSTySgg0rzraQ-1; Tue, 20 Dec 2022 09:02:36 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6858E85C069; Tue, 20 Dec 2022 14:02:35 +0000 (UTC) Received: from kostyanf14nb.Dlink (ovpn-192-73.brq.redhat.com [10.40.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77CDA14152F4; Tue, 20 Dec 2022 14:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671544962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EiqpLgMdKm5wDoDtt0Ai72IZcAFTUwTuIR+jsui5eJE=; b=OzodAwT2zz0jwpjSHZd6if3rqeQy6niOaFsGn7iWAVBRwoeU48XaBfvVJQ1SzW9EvcPZah jNUOwB0Lnf8yJRobxZQr0MrGi+N/zp9bFhoIKIKXQBa8ceP16mnDNbpu5hWz7Y7mudW6qX AwTLycyrdETcrOwlsPu9FqsxmDlSL48= X-MC-Unique: YQPPFxisOsSTySgg0rzraQ-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL v3 5/6] qga: map GLib log levels to system levels Date: Tue, 20 Dec 2022 16:02:24 +0200 Message-Id: <20221220140225.615908-6-kkostiuk@redhat.com> In-Reply-To: <20221220140225.615908-1-kkostiuk@redhat.com> References: <20221220140225.615908-1-kkostiuk@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.7 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=kkostiuk@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: 1671545371736100003 From: Andrey Drobyshev This patch translates GLib-specific log levels to system ones, so that they may be used by both *nix syslog() (as a "priority" argument) and Windows ReportEvent() (as a "wType" argument). Currently the only codepath to write to "syslog" domain is slog() function. However, this patch allows the interface to be extended. Note that since slog() is using G_LOG_LEVEL_INFO level, its behaviour doesn't change. Originally-by: Yuri Pudgorodskiy Signed-off-by: Andrey Drobyshev Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Konstantin Kostiuk Tested-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/main.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/qga/main.c b/qga/main.c index 1463a1c170..85b7d6ced5 100644 --- a/qga/main.c +++ b/qga/main.c @@ -314,6 +314,38 @@ void ga_enable_logging(GAState *s) s->logging_enabled =3D true; } =20 +static int glib_log_level_to_system(int level) +{ + switch (level) { +#ifndef _WIN32 + case G_LOG_LEVEL_ERROR: + return LOG_ERR; + case G_LOG_LEVEL_CRITICAL: + return LOG_CRIT; + case G_LOG_LEVEL_WARNING: + return LOG_WARNING; + case G_LOG_LEVEL_MESSAGE: + return LOG_NOTICE; + case G_LOG_LEVEL_DEBUG: + return LOG_DEBUG; + case G_LOG_LEVEL_INFO: + default: + return LOG_INFO; +#else + case G_LOG_LEVEL_ERROR: + case G_LOG_LEVEL_CRITICAL: + return EVENTLOG_ERROR_TYPE; + case G_LOG_LEVEL_WARNING: + return EVENTLOG_WARNING_TYPE; + case G_LOG_LEVEL_MESSAGE: + case G_LOG_LEVEL_INFO: + case G_LOG_LEVEL_DEBUG: + default: + return EVENTLOG_INFORMATION_TYPE; +#endif + } +} + static void ga_log(const gchar *domain, GLogLevelFlags level, const gchar *msg, gpointer opaque) { @@ -327,9 +359,9 @@ static void ga_log(const gchar *domain, GLogLevelFlags = level, level &=3D G_LOG_LEVEL_MASK; if (g_strcmp0(domain, "syslog") =3D=3D 0) { #ifndef _WIN32 - syslog(LOG_INFO, "%s: %s", level_str, msg); + syslog(glib_log_level_to_system(level), "%s: %s", level_str, msg); #else - ReportEvent(s->event_log, EVENTLOG_INFORMATION_TYPE, + ReportEvent(s->event_log, glib_log_level_to_system(level), 0, 1, NULL, 1, 0, &msg, NULL); #endif } else if (level & s->log_level) { --=20 2.25.1 From nobody Tue May 14 07:53:35 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=1671545221; cv=none; d=zohomail.com; s=zohoarc; b=fn/NQh9nEU89wsxtmdHkGuZhpa0DmJuhZ0N3u0LMWnBOJ/Sglr9tuevFSLRm7mTGRRAyLrqwFtwUCbc0Q3Nt71vFD5XC/+5RSqCCbPQjS7X1SO7aNIEmXePoTqU6DQlNQYjkHxS3TSlrJHXCELDMdBt5R7cR/2aAlDvjug9QxbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671545221; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iMGQ5cqCeW/clg/pT0LLbhmTyLVIZB4Mn44e9XgAK3A=; b=SraaRu8YdldYzpdREv25742BZ0y0iYUMevIZr9tybi4GlPyBq+O28cJpBI1xMdJp1jtpUAZlbEkNxtUUEjtGxcn++V7n/8rv7YLV83d5OWmImHUhTtGW1l9tJx2vbLUVzwN3rsbFwv+cQv4H4ubRVqcvlBCvshPERtBfPrlysRg= 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 1671545221185939.689394838889; Tue, 20 Dec 2022 06:07:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dCg-0005zt-Vw; Tue, 20 Dec 2022 09:02:47 -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 1p7dCc-0005xz-HC for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02:42 -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 1p7dCZ-0002Y5-Ue for qemu-devel@nongnu.org; Tue, 20 Dec 2022 09:02:41 -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-625-aGMwF5BQPee7aZ0frnOsfg-1; Tue, 20 Dec 2022 09:02:37 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2E48101A52E; Tue, 20 Dec 2022 14:02:36 +0000 (UTC) Received: from kostyanf14nb.Dlink (ovpn-192-73.brq.redhat.com [10.40.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B84C714152F6; Tue, 20 Dec 2022 14:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671544959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iMGQ5cqCeW/clg/pT0LLbhmTyLVIZB4Mn44e9XgAK3A=; b=KnaBhC74CSc12I2hgU2fLMSo50MHdxuNtELPT64MpLe6kFu5i70TuCWXBQx9Sz+dlgcKS8 lPBqg9+RBnII1j02tiKBhj3RlH0owUw2Uvh/kcXoyBBwDkfZywOCCmJEHmvE2Z1qmzYyzA zPXJ7136WD4A/PcW5wYn/dHqLFOUy+0= X-MC-Unique: aGMwF5BQPee7aZ0frnOsfg-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL v3 6/6] qga-win: choose the right libpcre version to include in MSI package Date: Tue, 20 Dec 2022 16:02:25 +0200 Message-Id: <20221220140225.615908-7-kkostiuk@redhat.com> In-Reply-To: <20221220140225.615908-1-kkostiuk@redhat.com> References: <20221220140225.615908-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=kkostiuk@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: 1671545222775100003 Content-Type: text/plain; charset="utf-8" From: Andrey Drobyshev According to GLib changelog [1], since version 2.73.2 GLib is using libpcre2 instead of libpcre. As a result, qemu-ga MSI installation fails due to missing DLL when linked with the newer GLib. This commit makes wixl to put the right libpcre version into the MSI bundle: either libpcre-1.dll or libpcre2-8-0.dll, depending on the present version of GLib. [1] https://gitlab.gnome.org/GNOME/glib/-/releases#2.73.2 Previous version: https://lists.nongnu.org/archive/html/qemu-trivial/2022-11/msg00237.html Signed-off-by: Andrey Drobyshev Reviewed-by: Konstantin Kostiuk Tested-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/installer/qemu-ga.wxs | 12 +++++++++--- qga/meson.build | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index e344c38e74..51340f7ecc 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -101,9 +101,15 @@ - - - + + + + + + + + + diff --git a/qga/meson.build b/qga/meson.build index 1ff159edc1..ad17dc7dca 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -140,6 +140,11 @@ if targetos =3D=3D 'windows' qemu_ga_msi_vss =3D ['-D', 'InstallVss'] deps +=3D qga_vss endif + if glib.version() < '2.73.2' + libpcre =3D 'libpcre1' + else + libpcre =3D 'libpcre2' + endif qga_msi =3D custom_target('QGA MSI', input: files('installer/qemu-ga.wxs'), output: 'qemu-ga-@0@.msi'.format(host_arch), @@ -153,6 +158,7 @@ if targetos =3D=3D 'windows' '-D', 'QEMU_GA_VERSION=3D' + config_host['QE= MU_GA_VERSION'], '-D', 'QEMU_GA_MANUFACTURER=3D' + config_hos= t['QEMU_GA_MANUFACTURER'], '-D', 'QEMU_GA_DISTRO=3D' + config_host['QEM= U_GA_DISTRO'], + '-D', 'LIBPCRE=3D' + libpcre, ]) all_qga +=3D [qga_msi] alias_target('msi', qga_msi) --=20 2.25.1