From nobody Wed Nov 5 11:06:35 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540294450279321.9245043478213; Tue, 23 Oct 2018 04:34:10 -0700 (PDT) Received: from localhost ([::1]:40323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEuwj-0001bZ-U7 for importer@patchew.org; Tue, 23 Oct 2018 07:34:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEumk-0001qr-JL for qemu-devel@nongnu.org; Tue, 23 Oct 2018 07:23:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEumi-0007kG-4y for qemu-devel@nongnu.org; Tue, 23 Oct 2018 07:23:42 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43661) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gEumg-0007g5-48 for qemu-devel@nongnu.org; Tue, 23 Oct 2018 07:23:39 -0400 Received: by mail-wr1-f67.google.com with SMTP id t10-v6so1248729wrn.10 for ; Tue, 23 Oct 2018 04:23:37 -0700 (PDT) Received: from localhost.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id g8-v6sm1498990wmf.45.2018.10.23.04.23.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 04:23:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OIgNfiCRVar7f5mchA+lbc36v3cwZ4vJmRTbZZ83cSc=; b=fQShxB8LyRmjaPboeegZ41UrbOzsyz+0OBoasf+73cFsjQ6uj+IAk1e+EJBLC6Obus aAbNCfM0BY+ev4pU28zh643G/w6uC2uMPDOXo4Nc+bxmhRGAoZo8OcXOkLAKOLtjilXY u9KePZ61Rq5ZeaRtyQQX6JHQ9OdIXg+HuMGoXHPJ3uQu55MY2k8h3U5XWhuwxoiJCIWl 8eE/T72t4BFmyubkspLAG3zJ1alSiQBCvdMuNOeMf/1y6Mf747D6Nll9tc6y+H17CYiC OFya9yOwmkXU623e4NMgiQQGY9iCOMkKP0TD+qK51dzg0wxOWFM6gP1HjVFl5MeKEDYy Lbpg== X-Gm-Message-State: AGRZ1gJ39bMUd+cofDb7J6gyYT8jjLYdBfvOFU9cvAYk0aLwUQW8p4S3 +bI1xtIJVAJjO7/tHsoZQCLPJ+kPwvY= X-Google-Smtp-Source: AJdET5fmigp+1RmPJN9q4QeeMvkkLdYTLnJlh7csY3jpXJP4HYE8Fv/kGQ4fhEwx+hPE2BgMZx8lJg== X-Received: by 2002:a5d:558b:: with SMTP id i11-v6mr5860379wrv.38.1540293815884; Tue, 23 Oct 2018 04:23:35 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: qemu-devel@nongnu.org Date: Tue, 23 Oct 2018 13:23:17 +0200 Message-Id: X-Mailer: git-send-email 2.19.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.221.67 Subject: [Qemu-devel] [PATCH v5 08/14] 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: Michael Roth , Olga Krishtal , =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , Sameeh Jubran , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 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 --- dtc | 2 +- qga/commands-win32.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dtc b/dtc index 88f18909db..e54388015a 160000 --- a/dtc +++ b/dtc @@ -1 +1 @@ -Subproject commit 88f18909db731a627456f26d779445f84e449536 +Subproject commit e54388015af1fb4bf04d0bca99caba1074d9cc42 diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 44b6b1ce88..a3d28d06b3 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; @@ -503,6 +509,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; @@ -528,6 +535,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 @@ -536,6 +544,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; } =20 @@ -543,6 +552,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; } =20 @@ -550,6 +560,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; } =20 @@ -613,6 +624,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) { @@ -620,6 +632,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; @@ -627,6 +640,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. */ @@ -640,6 +654,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.19.0