From nobody Thu Nov 6 12:13:08 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 1540911274908422.6080048618751; Tue, 30 Oct 2018 07:54:34 -0700 (PDT) Received: from localhost ([::1]:53687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHVPd-0008Pv-3n for importer@patchew.org; Tue, 30 Oct 2018 10:54:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHVG8-0007Va-R3 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 10:44:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHVG6-00007V-TK for qemu-devel@nongnu.org; Tue, 30 Oct 2018 10:44:44 -0400 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]:46270) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHVG6-0008HR-Lk for qemu-devel@nongnu.org; Tue, 30 Oct 2018 10:44:42 -0400 Received: by mail-qt1-x832.google.com with SMTP id c16-v6so13683820qtj.13 for ; Tue, 30 Oct 2018 07:44: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 h49-v6sm18065678qth.32.2018.10.30.07.44.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Oct 2018 07:44:25 -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=NiRdbBNjTrwMKi7lSt3Z11eKucRHGQBOjmw9roH+Q8wCSzzxG4v8QzS2w5JgvduWrd xL2mJ26LmNpRYoRlcv1bdFJ6cAJcsnj4Npl6uk6HmpxCpsreq5HHp/HI3dpiOtXFSRbP /z7p44x8NGZG7n5Oq+BEBCIXY+co4Sb+qYGLSiihHGZFwYV1g/VeGWjOVzjANnvgMQtD rNDH6svtMZaYnuOxrFy9eRdwgZhfwxeThApRadLhInql7dOkn2aKdzkOsU6zpQ+rld59 WQT3Mj6AUR4zmG8On3N2fuT8NM6Rcr29Pixg56rSWQ7k3bbggqvOWVfVkYKdDwng8Leo mRGw== 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=WHBpMglTNl7I1qILsw0vLFeG58BVeolOZZpPdpTWrX9PqkhknYfV6zssn7ERnU7LRz cEd2J9SvLqrh61yAB7TVQClPujUfZijlMJkJ3pTBjIL0IKbW8HKJlyyaqfmL4u8Xgztr Lzb8nO8i3d/g9W232GbZYwPo7E6rS7F/rp3S6J+55oXjHPjEZNJIyeyoQnabbPdiTAIV 6hYYU5BMHvlpAsXX0ZN+Qj6UQkUSEW49KjAS5V2o6EVv1txTKjFXcmhNCPG9pUKFf+gM Nb2wjSvlsjQJvjqYFt1EyPYacBuixpEOZbpXTlrzMAUFb8cr1izlAJ5j76e7h0a/lo7l 5EaA== X-Gm-Message-State: AGRZ1gJ/1QrlZ10aICXJarNJ3TtqJyr3fn95zIobnYSOVWmKfK6xl1mH qCEXoKvsTRg3nyqZzOGxPKyPRFAF X-Google-Smtp-Source: AJdET5eolyHboDk/o2XyxpyakW7ulb+WQrh36HsIfeW365O6XnPqbvRMK8nIlwrRIZ0xsg7+xGqSgA== X-Received: by 2002:a0c:db04:: with SMTP id d4mr9095707qvk.114.1540910666142; Tue, 30 Oct 2018 07:44:26 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 30 Oct 2018 09:43:44 -0500 Message-Id: <20181030144358.23144-11-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181030144358.23144-1-mdroth@linux.vnet.ibm.com> References: <20181030144358.23144-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::832 Subject: [Qemu-devel] [PULL 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