From nobody Sun Feb 8 11:07:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1595892270; cv=none; d=zohomail.com; s=zohoarc; b=N9jNlv5U+eBss5hP/zBsLPrRJc80Hy3VHugMIrm964mP2CfaweuNexKi1ycKlhewZN3wxhHeSGWIQM1r9Ioh+l6GeBLj4VDxJDWFCo+0yVpRR6T6vQFWEmTKPvhDuG3x+HaFbFkW/fIfIUB5RF75rx4zx2T/2R6H4/hgV+Mf86I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595892270; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=wuQZwfssSAsYztJ3hgK0A+C7+4FbLE10/5wG+EJMbpU=; b=hJP1tfQHPhAX3LZ2/DS/9TZ0fefa1d4fupfsAGUNP7Cx16QcrgCv08HatspRd+CluFhSeyYxSRXmKyhVjt5wIu3zJAPigz3PsxlDTHkH4KNTtTAH98q18yNTgpttYKXuJwMK5EksiMQuJwC8mvznBO7nam/k8OoNeoavzxWnS50= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595892270518620.242603134781; Mon, 27 Jul 2020 16:24:30 -0700 (PDT) Received: from localhost ([::1]:34414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0CTt-0008Uu-9d for importer@patchew.org; Mon, 27 Jul 2020 19:24:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0CT1-0007Er-7K for qemu-devel@nongnu.org; Mon, 27 Jul 2020 19:23:35 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]:43341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0CSz-00060B-G7 for qemu-devel@nongnu.org; Mon, 27 Jul 2020 19:23:34 -0400 Received: by mail-oo1-xc30.google.com with SMTP id z10so597713ooi.10 for ; Mon, 27 Jul 2020 16:23:33 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id f26sm2737338oop.46.2020.07.27.16.23.31 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jul 2020 16:23:31 -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; bh=wuQZwfssSAsYztJ3hgK0A+C7+4FbLE10/5wG+EJMbpU=; b=pNgzBvLdF84dOrviSw0i4irLw8H/4wb4P6xc37nfe7j58nl09H1k9swD/3bqqE3KzI EuMVOvmttJQEjwjc54ZYBPVMTIr2ddkGSC2yYklHnmHH8+C3g2BriO9bVexpye0y4vEm 5CDtK3S+gZpN6see5VI50XAOLt93J9OEmqRQRAoY6ffqjlAKDZTJrC2bx7wBl/RbG15R E0/Ek3SEw7Z5r5ukrcc5cmGGtHl4Lkqk1yY9eM53DYcwQeZdWVQF2C1jdKQ8k+aA+g7S PiifTeyYMOU6GqQkY1L5aNRHki6cKs4KZeM6CVZsPsV6uzEIv34OunI3gq6KjgUZc+QZ zxCg== 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; bh=wuQZwfssSAsYztJ3hgK0A+C7+4FbLE10/5wG+EJMbpU=; b=dqTDARBb4lSOdSH3rmNw/UFcZqM/gAGt/Tm3dRd/hardIpfmZ8OCKKU0PGi1OBa1TX GZ6F6FRHOLOd/JP1PZuIrfFmhd3HSHapvIXrRDsBTSuLM2dXbL6i21S+Ju6ZIOTQWwLy phz7IHcsX+hB27OvLSkNnulsFErkMtswUXz1Ei02lun3/+E2Wzs4YyP5TNlVDFlE4CeP Js+hVFyZ9k1LGrWi0OEJhFWMFU4xWx664yz161LlOu+SAIFd+gZwgm5c0pGZO7j4sK3A jvt11dbatsXLcVCuGGiTVhuwN8pIWkWfW8UAGbkU0ikqGXaFK1MJObbDKOGKX3f0GMZ5 EOpA== X-Gm-Message-State: AOAM533oROI4SIcKJ2pCuEwfuSRfvjTuSFCt4gfnUpH7tDMflAkyipC5 mtFAJuC3rJMRGzQNsPL3QsI4DRbY X-Google-Smtp-Source: ABdhPJxlMxmU88eFfMfOthsbHp9kPLIFU2jJWX2heQHuDC53lD5kQ8p83o0TRb4uvtWr3IaymuIiBQ== X-Received: by 2002:a4a:d74d:: with SMTP id h13mr22794219oot.56.1595892212098; Mon, 27 Jul 2020 16:23:32 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Subject: [PULL for-5.1 1/2] qga-win: fix "guest-get-fsinfo" wrong filesystem type Date: Mon, 27 Jul 2020 18:22:36 -0500 Message-Id: <20200727232237.31024-2-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200727232237.31024-1-mdroth@linux.vnet.ibm.com> References: <20200727232237.31024-1-mdroth@linux.vnet.ibm.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=flukshun@gmail.com; helo=mail-oo1-xc30.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Basil Salman , Basil Salman Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Basil Salman This patch handles the case where unmounted volumes exist, where in that case GetVolumePathNamesForVolumeName returns empty path, GetVolumeInformation will use the current working directory instead. This patch fixes the issue by opening a handle to the volumes, and using GetVolumeInformationByHandleW instead. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1746667 Signed-off-by: Basil Salman Signed-off-by: Basil Salman *fix crash when guest_build_fsinfo() sets errp multiple times *make new error message more distinct from existing ones Signed-off-by: Michael Roth --- qga/commands-win32.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index aaa71f147b..15c9d7944b 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -958,11 +958,13 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *= guid, Error **errp) { DWORD info_size; char mnt, *mnt_point; + wchar_t wfs_name[32]; char fs_name[32]; - char vol_info[MAX_PATH+1]; + wchar_t vol_info[MAX_PATH + 1]; size_t len; uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; GuestFilesystemInfo *fs =3D NULL; + HANDLE hLocalDiskHandle =3D NULL; =20 GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size); if (GetLastError() !=3D ERROR_MORE_DATA) { @@ -977,18 +979,27 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *= guid, Error **errp) goto free; } =20 + hLocalDiskHandle =3D CreateFile(guid, 0 , 0, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | + FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (INVALID_HANDLE_VALUE =3D=3D hLocalDiskHandle) { + error_setg_win32(errp, GetLastError(), "failed to get handle for v= olume"); + goto free; + } + len =3D strlen(mnt_point); mnt_point[len] =3D '\\'; mnt_point[len+1] =3D 0; - if (!GetVolumeInformation(mnt_point, vol_info, sizeof(vol_info), NULL,= NULL, - NULL, (LPSTR)&fs_name, sizeof(fs_name))) { + + if (!GetVolumeInformationByHandleW(hLocalDiskHandle, vol_info, + sizeof(vol_info), NULL, NULL, NULL, + (LPWSTR) & wfs_name, sizeof(wfs_nam= e))) { if (GetLastError() !=3D ERROR_NOT_READY) { error_setg_win32(errp, GetLastError(), "failed to get volume i= nfo"); } goto free; } =20 - fs_name[sizeof(fs_name) - 1] =3D 0; fs =3D g_malloc(sizeof(*fs)); fs->name =3D g_strdup(guid); fs->has_total_bytes =3D false; @@ -1007,9 +1018,11 @@ static GuestFilesystemInfo *build_guest_fsinfo(char = *guid, Error **errp) fs->has_used_bytes =3D true; } } + wcstombs(fs_name, wfs_name, sizeof(wfs_name)); fs->type =3D g_strdup(fs_name); fs->disk =3D build_guest_disk_info(guid, errp); free: + CloseHandle(hLocalDiskHandle); g_free(mnt_point); return fs; } @@ -1027,8 +1040,12 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error = **errp) } =20 do { - GuestFilesystemInfo *info =3D build_guest_fsinfo(guid, errp); - if (info =3D=3D NULL) { + Error *local_err =3D NULL; + GuestFilesystemInfo *info =3D build_guest_fsinfo(guid, &local_err); + if (local_err) { + g_debug("failed to get filesystem info, ignoring error: %s", + error_get_pretty(local_err)); + error_free(local_err); continue; } new =3D g_malloc(sizeof(*ret)); --=20 2.17.1 From nobody Sun Feb 8 11:07:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1595892270; cv=none; d=zohomail.com; s=zohoarc; b=jg91w8LM1BsDj299DUAfOdUlNG66nGdHoXp9GABukBhwTdYUnZC/xRDpEgalZx5pZwC2Fy7iToyCo08Y1LSCkDPpZUXeu0/wv2xvvbz+CheG2UXNC5xsUClVaF4FV9t6Y5E9zz29yoI0dehweZCgeIdc5+Ci7uYoUBJa4ZkPXEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595892270; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ucNQHb5+qEkxz1CBTGPeVzSEnjAxJDTcCt7fEqPv3qo=; b=glUFDv9LM3egZ99VsAuNlr+FmnGS9dw0fsF2WoTOZejS7dvqFQLouBnw5AfGtwQpZYoCCt4Y+e5PBDIU9zxTfnn5iobnF/NkEhEAj6ePSX60QVkZcG4eP4m0RiLCS880rQG1XonxBS5SomiOOBDJVRRDqidcpzwo//cnsh2y/1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159589227065553.347678013859195; Mon, 27 Jul 2020 16:24:30 -0700 (PDT) Received: from localhost ([::1]:34384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0CTt-0008U8-3x for importer@patchew.org; Mon, 27 Jul 2020 19:24:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0CT2-0007Fj-5H for qemu-devel@nongnu.org; Mon, 27 Jul 2020 19:23:36 -0400 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]:35516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0CT0-00060G-Ka for qemu-devel@nongnu.org; Mon, 27 Jul 2020 19:23:35 -0400 Received: by mail-oi1-x22e.google.com with SMTP id k4so15854095oik.2 for ; Mon, 27 Jul 2020 16:23:34 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id n189sm2353980oib.30.2020.07.27.16.23.32 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jul 2020 16:23:32 -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=ucNQHb5+qEkxz1CBTGPeVzSEnjAxJDTcCt7fEqPv3qo=; b=WgSa9mOZuf2H8Vuc88sJDsMgpi3N3TBE1w6PD3EWfCB0vZ3Hpj1HwToLtcr5Ok9xAb buvS026gkfDo8c+p94Ngc2FFGUoLoI7PNHBxL18mTywHzoXa/CcdhmrRmKZpX7KZX5Z9 3WF3W66ilTugnql4iKv77O7hb38zQtYTCafZRy2NUCQPbUfJ/tAuXntG+XYbv3fb5Vvi FkokfOfMGFBgsMHOTZY+srjyr1GmcxqHIq6X9J6BzrgL9xSJ1Y2naUWXUHoj9gqoW6XW 5YhAgb+MdAFQ4H0iQ5g5GX22MTDLbusLpnKmUz21XZnxstlxplTUnEkqetSh5yaTm/d3 mCGA== 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=ucNQHb5+qEkxz1CBTGPeVzSEnjAxJDTcCt7fEqPv3qo=; b=VqiInRiBfMZ4vNl+fvIOFNRrSiSz0c8sPMHB/bSSM8K8uBhdHfsn6oav7Z1U34YZtR 2oi2YUuYybyUcQk2Mm11bSddEpHlDFhsoMF4MBMF5UqxuPptlXjUsZJWhsS3XWO5WSfV S/gDEs7HB7A6fu0SCK9NyE50BUmRvBjtCB3b4eXr2LwRpIfJKm2qISdfqozeZu9XvqkE eUz+CS3ToVuahh3GfcLzJKN6JlcQRFyMhSeMt580JHpu+Jv3W3JZzfXMH255iJkEyQ+g YT9uOhikm/PFchIb86vR3O57n41vckLhFQo6NWMeEh2A34CqN+pmgRpKOBoQAHItBMAl dZHA== X-Gm-Message-State: AOAM533G+C1QGkdNLn7cTcUxgqeAQx2lwuySes+ovOErsUnsVneTvbq6 671T0dpa7fwDHc9y7+bQfT2FR8yL X-Google-Smtp-Source: ABdhPJxr4i4yxo8pMjqbIXZ/yAsCowNItDvCxKPKx8JwywrJjUMZrWcJM8ijiM0kr8W178edgz/C8w== X-Received: by 2002:aca:784:: with SMTP id 126mr1415300oih.33.1595892213296; Mon, 27 Jul 2020 16:23:33 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Subject: [PULL for-5.1 2/2] qga/qapi-schema: Document -1 for invalid PCI address fields Date: Mon, 27 Jul 2020 18:22:37 -0500 Message-Id: <20200727232237.31024-3-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200727232237.31024-1-mdroth@linux.vnet.ibm.com> References: <20200727232237.31024-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=flukshun@gmail.com; helo=mail-oi1-x22e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thomas Huth The "guest-get-fsinfo" could also be used for non-PCI devices in the future. And the code in GuestPCIAddress() in qga/commands-win32.c seems to be using "-1" for fields that it can not determine already. Thus let's properly document "-1" as value for invalid PCI address fields. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth Signed-off-by: Michael Roth --- qga/qapi-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 4be9aad48e..408a662ea5 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -846,7 +846,7 @@ ## # @GuestDiskAddress: # -# @pci-controller: controller's PCI address +# @pci-controller: controller's PCI address (fields are set to -1 if inval= id) # @bus-type: bus type # @bus: bus id # @target: target id --=20 2.17.1