From nobody Wed Nov 5 18:24:24 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536320672669322.2011325064368; Fri, 7 Sep 2018 04:44:32 -0700 (PDT) Received: from localhost ([::1]:38019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyFBY-0002za-Vf for importer@patchew.org; Fri, 07 Sep 2018 07:44:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyF9d-0000tW-5l for qemu-devel@nongnu.org; Fri, 07 Sep 2018 07:42:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyF9Z-00048j-3f for qemu-devel@nongnu.org; Fri, 07 Sep 2018 07:42:25 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:53157) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fyF9Y-00046e-OU for qemu-devel@nongnu.org; Fri, 07 Sep 2018 07:42:20 -0400 Received: by mail-wm0-f53.google.com with SMTP id y139-v6so14323940wmc.2 for ; Fri, 07 Sep 2018 04:42:20 -0700 (PDT) Received: from fiorina.redhat.com (ip-94-112-73-67.net.upcbroadband.cz. [94.112.73.67]) by smtp.gmail.com with ESMTPSA id z184-v6sm25239813wmz.0.2018.09.07.04.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 04:42:18 -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=8pl2VA6Cid++Qn2KS9lC9ILyRJ2b8EWTQPL7DYjPfo8=; b=AHY+XxFmayW0tb2gAEhGcSlR2XKf7cJ1VmKfqmJ7fbOZzoYRzPzjlWgX2F/hGJ2pVE 4HB5Y3COnsnG1tnStuf3IKGehRsZuaiJrCK17ePlUWF4rjfzqYiaUdPeZ0busoigutF7 0TBmqMEqagz6UfR38DckTqISw2VCW0H3bfcFFXTa2ybqupkdFUk1tpvMqVNrr9C2bePx 4rX/kBxzxV0YTOT8Uj2VAEn/kuVWX+rzr4drdlJnkGkfswR1BZ4I1CQLVWbCUD1Bkose iFEetCXDJEmhqBUCMOPU1KPMiGzfcgb4ONJXJ93L1LXXgrNwKuqB/+hTuM8Zd8RR8Atr C3kA== X-Gm-Message-State: APzg51DZpiaIBAIh5nx4yGEZkjXuRVmUo3MutEIf4qlmLEfJIzEtOgcM r8PVCxnKImm1IBVTx76VJJSrDS/treE= X-Google-Smtp-Source: ANB0VdbYC4a0MqyXLjdyHFZWyrHmCa91lixfS7QYAbygF56vGvEScWFerWq3Zy+QqsW80sPbOfKBAg== X-Received: by 2002:a1c:4d09:: with SMTP id o9-v6mr5175028wmh.134.1536320539078; Fri, 07 Sep 2018 04:42:19 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: qemu-devel@nongnu.org Date: Fri, 7 Sep 2018 13:42:11 +0200 Message-Id: <6614d7912a3ce65158ff17f977fd9b7c1aa45559.1536320522.git.tgolembi@redhat.com> X-Mailer: git-send-email 2.18.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: 74.125.82.53 Subject: [Qemu-devel] [PATCH v3 3/5] qga: win32: 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: Olga Krishtal , =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , Michael Roth , =?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 --- qga/commands-win32.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 9c959122d9..e16c58275e 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 g_debug_err(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; @@ -498,6 +504,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, func, dev, data, size2; @@ -522,6 +529,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 @@ -530,6 +538,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) */ if (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_BUSNUMBER, &data, (PBYTE)&bus, size, NULL)) { + g_debug_err("failed to get bus"); break; } =20 @@ -537,6 +546,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)) { + g_debug_err("failed to get address"); break; } =20 @@ -544,6 +554,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)) { + g_debug_err("failed to get slot"); break; } =20 @@ -608,6 +619,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) { @@ -615,6 +627,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; @@ -622,6 +635,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); if (bus =3D=3D BusTypeScsi || bus =3D=3D BusTypeAta || bus =3D=3D BusT= ypeRAID #if (_WIN32_WINNT >=3D 0x0600) /* This bus type is not supported before Windows Server 2003 S= P1 */ @@ -631,6 +645,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)) { Error *local_err =3D NULL; --=20 2.18.0