From nobody Thu Nov 6 12:14:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540950320219271.87330794887; Tue, 30 Oct 2018 18:45:20 -0700 (PDT) Received: from localhost ([::1]:56604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHfZP-000553-0e for importer@patchew.org; Tue, 30 Oct 2018 21:45:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHfUc-0000JJ-59 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:40:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHfUX-000233-3D for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:40:22 -0400 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:33557) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHfUV-0001tC-KM for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:40:16 -0400 Received: by mail-qk1-x736.google.com with SMTP id o89so8595578qko.0 for ; Tue, 30 Oct 2018 18:40:03 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id 53-v6sm18429959qtw.52.2018.10.30.18.40.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Oct 2018 18:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2TYlUdwcjes9Hsxl3QO7bcr473sAzRxMT3hABlS6QMc=; b=cmkymjPXbVhnagJUxaQ+lNcisIfQKECUiuQsHDeeyBnq8RZHmymcAxM5G9y/JBUsdH IS8hGXBVbqZxXBSQwpaFMDj29IGQVi2OYxXxhvF0LyojZpvN7AxTNT1Bkv4H0IDi0ImQ IBQCJT4ziRBWXdrkWN24xA4e7jNXCDQBIntqfNsia3FNUk2wZPNCDRdYnfDzJ5fAG3Xh rwvPzvgfpZI83XKThB28WtGsLtjBLuj9nmg5aJx0LTBGafYO6gZUSUR+Jl3RFso632zp Tmct5GIpUQbBJkyHyZQ7umqCPW0oPYUzJNTimHbDGX0m0OiTWA40MqRfTmBzFDQKiIbS jnXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2TYlUdwcjes9Hsxl3QO7bcr473sAzRxMT3hABlS6QMc=; b=rNSLtOhp1I26dO+Tz6x4Q+z8Kn3NLXnjQ4WD/B8Gmx6Lu7Qg+9Mk4s4lr1PUoKhZO/ YVRq3bXljQUPfm4Y8rBVV+rqSs8hqdOH8AYvYlu4R/Navc03Dc41OUn42Xf70gxv8b9g 2eLI/NYb+JmfZDBeAxQsPieBB0JzloMe806DXW2IAeMya52Xygabq0Qkhf7K/J3zEUK7 bI/sV3v51Jrx702uNB116spPH2GyHxKpGNkqN/Btkslzr/W6UlzOtK0y52xxObMElPGV zC/jHVKazogo4ulIpp4UqfEFpQXt3pms8ZtthOGz8PTTYftaYc1I5mHHxJJ1KiaSwcv4 5PAA== X-Gm-Message-State: AGRZ1gLZP7L56ZE/9E/RaL8UmDzl/qgn7nj0vnAHyRjZPVREbiJs0K+T jcwxHu1fPND8/oQwQqS5RPLGn0Js X-Google-Smtp-Source: AJdET5cwjgDWDzGCXJ32LNWsIHyWS3RedqOYobGfw5sZnhpqCoDuE006740BtZNgpCYrufyy/G6A7A== X-Received: by 2002:a37:ac05:: with SMTP id e5mr966360qkm.102.1540950002174; Tue, 30 Oct 2018 18:40:02 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 30 Oct 2018 20:38:07 -0500 Message-Id: <20181031013821.24023-11-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031013821.24023-1-mdroth@linux.vnet.ibm.com> References: <20181031013821.24023-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::736 Subject: [Qemu-devel] [PULL v2 10/24] qga-win: add debugging information X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The windows code generaly lacks debug information (compared to posix code). This patch adds some related to HW info in guest-get-fsinfo command. Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Michael Roth --- qga/commands-win32.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 4fe1517778..1a21aac5ad 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -89,6 +89,12 @@ static OpenFlags guest_file_open_modes[] =3D { {"a+b", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS } }; =20 +#define debug_error(msg) do { \ + char *suffix =3D g_win32_error_message(GetLastError()); \ + g_debug("%s: %s", (msg), suffix); \ + g_free(suffix); \ +} while (0) + static OpenFlags *find_open_flag(const char *mode_str) { int mode; @@ -518,6 +524,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) goto out; } =20 + g_debug("enumerating devices"); dev_info_data.cbSize =3D sizeof(SP_DEVINFO_DATA); for (i =3D 0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++)= { DWORD addr, bus, slot, data, size2; @@ -543,6 +550,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) if (g_strcmp0(buffer, dev_name)) { continue; } + g_debug("found device %s", dev_name); =20 /* There is no need to allocate buffer in the next functions. The = size * is known and ULONG according to @@ -551,6 +559,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) */ if (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_BUSNUMBER, &data, (PBYTE)&bus, size, NULL)) { + debug_error("failed to get bus"); bus =3D -1; partial_pci =3D true; } @@ -559,6 +568,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) * transformed into device function and number */ if (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_ADDRESS, &data, (PBYTE)&addr, size, NULL)) { + debug_error("failed to get address"); addr =3D -1; partial_pci =3D true; } @@ -567,6 +577,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) * This number is typically a user-perceived slot number. */ if (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_UI_NUMBER, &data, (PBYTE)&slot, size, NULL)) { + debug_error("failed to get slot"); slot =3D -1; partial_pci =3D true; } @@ -639,6 +650,7 @@ static GuestDiskAddressList *build_guest_disk_info(char= *guid, Error **errp) scsi_ad =3D &addr; char *name =3D g_strndup(guid, strlen(guid)-1); =20 + g_debug("getting disk info for: %s", name); vol_h =3D CreateFile(name, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (vol_h =3D=3D INVALID_HANDLE_VALUE) { @@ -646,6 +658,7 @@ static GuestDiskAddressList *build_guest_disk_info(char= *guid, Error **errp) goto out_free; } =20 + g_debug("getting bus type"); bus =3D get_disk_bus_type(vol_h, errp); if (bus < 0) { goto out_close; @@ -653,6 +666,7 @@ static GuestDiskAddressList *build_guest_disk_info(char= *guid, Error **errp) =20 disk =3D g_malloc0(sizeof(*disk)); disk->bus_type =3D find_bus_type(bus); + g_debug("bus type %d", disk->bus_type); /* always set pci_controller as required by schema. get_pci_info() sho= uld * report -1 values for non-PCI buses rather than fail. fail the comma= nd * if that doesn't hold since that suggests some other unexpected @@ -672,6 +686,7 @@ static GuestDiskAddressList *build_guest_disk_info(char= *guid, Error **errp) /* We are able to use the same ioctls for different bus types * according to Microsoft docs * https://technet.microsoft.com/en-us/library/ee851589(v=3Dws.10)= .aspx */ + g_debug("getting pci-controller info"); if (DeviceIoControl(vol_h, IOCTL_SCSI_GET_ADDRESS, NULL, 0, scsi_a= d, sizeof(SCSI_ADDRESS), &len, NULL)) { disk->unit =3D addr.Lun; --=20 2.17.1