From nobody Sun Feb 8 14:52:25 2026 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 1540996526906653.0461977814402; Wed, 31 Oct 2018 07:35:26 -0700 (PDT) Received: from localhost ([::1]:59947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHraY-0007mg-ST for importer@patchew.org; Wed, 31 Oct 2018 10:35:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHrMf-0000vG-7i for qemu-devel@nongnu.org; Wed, 31 Oct 2018 10:21:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHrMZ-0007CH-E9 for qemu-devel@nongnu.org; Wed, 31 Oct 2018 10:20:55 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]:33790) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHrMY-0006wi-Uo for qemu-devel@nongnu.org; Wed, 31 Oct 2018 10:20:51 -0400 Received: by mail-oi1-x231.google.com with SMTP id c25-v6so13756981oiy.0 for ; Wed, 31 Oct 2018 07:20:27 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id a11-v6sm1200412oib.20.2018.10.31.07.20.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Oct 2018 07:20:24 -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=1tf5MH/hdz7EU70w7EmnOhBcf+PBwZwDbxK+mFuMPW4=; b=mwlKdym4jjtnWJeSWGUV0rErhOWxOUEWTCPtRKuIrQzE7XcnR76rQG2ZyrlOMkWEAB P3dNo8FTQ1EJt0DFZZS4byJ7qUi8YJaGfGhvHaNBS1W8lWlO0LuzvDk4rgLjcjPcEul7 KOZGmlvkkt34fpGKFSsJalX1RH+k0qjZUjrEyW/TlAj5vr9F+vV+vra9xul+6FCHDfqE FmHiwm1Vfl/tJAtCsXjW7h2M/tlAXVLLufmnJZwear0Dt6XNhsftXR3iQTqHCN10YhQ5 JjYm1sgY2uCbtfwdM1MODXYC+uDLsw98hMIgv1w+uUCEhL9tyhqg1wBMZ5y7led9Nxel TbtA== 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=1tf5MH/hdz7EU70w7EmnOhBcf+PBwZwDbxK+mFuMPW4=; b=EJWp81nAw+5fUblZiRrJf2A57hCD4SwVm8xJ4UDCIp+kEPl5YN3Lw0kRujNBCGZt2Y O9C1Q2IpPSfp3LuvHpCYrrjdKN/NJSGBWOOJovzSoPCif233JleuanWeRDOQ8rDS7OMp gbBhdT5mmPaVnjdnvu/gdAy7twhkmBmPT6jN3j1lPUM7+Hq97buHo8ktspbVR2P7ZhEz NWxJ7/oJtqQH0YlTP0o0XvtJcI19VXdQ2NfFj8p3eEjCCQo54xh1dWR5Ag2r7k5Yt3iL 9HlKpTV6DoRXZyZ9G+zWfqFHdWb10iituxxp2xoU2MXhVxIru9wIt/17k7J1tiqSv1Bq M5Aw== X-Gm-Message-State: AGRZ1gJcgQeEArH1fBzrmfMkHdqWwrf2UNuB1kdcOBsHC+4SqsNe3SYA u4eZu2QeW5ODvNnz+1lmf1hLhKyR X-Google-Smtp-Source: AJdET5cC2EAoLGm3B0HVLo23lRZRBNAFIMDod+ggHUIqEWqGF0D9+UMZBJRyJR/+VedV9LO45HxpLQ== X-Received: by 2002:aca:6257:: with SMTP id w84-v6mr1789937oib.326.1540995625711; Wed, 31 Oct 2018 07:20:25 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 31 Oct 2018 09:19:11 -0500 Message-Id: <20181031141925.30026-11-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031141925.30026-1-mdroth@linux.vnet.ibm.com> References: <20181031141925.30026-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::231 Subject: [Qemu-devel] [PULL v3 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) From: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD 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