From nobody Sun Sep 28 16:28:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=fail(p=none dis=none) header.from=smartx.com ARC-Seal: i=1; a=rsa-sha256; t=1758627285; cv=none; d=zohomail.com; s=zohoarc; b=HSJa1uwUHZf8QjYtmtAgJ0M8xEIWb+wKmd/Fe6+sQxo2cXT9FYdQNDDOui4sRTivDP7B3M9UVb12P9B1/N38lwM4CeOxnq5ppXaQ3knqRILGcb9KGXYPQ749molSFQ1BTOFGo+0UoRChoXYqx6jtZv8D4JDCY1cG1d+3OA7kTGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758627285; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Y3+5JLE2c+7D5Q+5qXD1dXhzjHwLON4/Atcl8U9Zp/E=; b=Y1avb7ihXv3kQpSnnFIPTMr+I+UPvmqcQdKspVwYSXeBIC/OM+33F/Xitp1Ol63eGEWKmfibrVNDko94Wkn6oaLpxGZytFCKSJ65xXMtLwz3V4EW2nllvHzDAL9ufUjhqAldWF9T7u68ihSp9QDE+3zRdES+xi3nYzfExRGwEmQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758627284878208.49526794983194; Tue, 23 Sep 2025 04:34:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v11Gp-0002Rv-T8; Tue, 23 Sep 2025 07:33:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v11Gk-0002Qk-CV for qemu-devel@nongnu.org; Tue, 23 Sep 2025 07:33:14 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v11GW-000793-S6 for qemu-devel@nongnu.org; Tue, 23 Sep 2025 07:33:14 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-77f22902b46so2657417b3a.0 for ; Tue, 23 Sep 2025 04:32:54 -0700 (PDT) Received: from localhost.localdomain ([125.69.0.79]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77f315254edsm6454583b3a.84.2025.09.23.04.32.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Sep 2025 04:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1758627172; x=1759231972; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y3+5JLE2c+7D5Q+5qXD1dXhzjHwLON4/Atcl8U9Zp/E=; b=OYlg3FGNr6tHW0x+/kJF19aUF8LKfUjvj6Rj/KM2Vf93IBjE93vdyoPbCPPqu8Mk6D KS0aYK9NOJgwGqYhEIEAizIRfIV4cIQEbgSBwXPV2YQhRQBgimdfsGODtFXj2/u0AJKy X9UWfcRlfZD0AsYVJxBb08JMET2ECNj5euUEOY0XsFPvX17wkb89lWXidU8ukp1RTora QAuGsoxAalvIfIlzuxClcqUF1RYVyahYpWeT//FHQw+9hLAqb+IRu30V2LL906xws6wT 2WIPrjtAMjjIWfe3WvDj2ZBkjM7mlq2VGBZZ7OvyVzr9mYRsax0HeBzG+ca+FfwHjp5B oJ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758627172; x=1759231972; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y3+5JLE2c+7D5Q+5qXD1dXhzjHwLON4/Atcl8U9Zp/E=; b=aKbiQCM7LiFzq/NRt81H9uYxMtBK6hhtKYVaxeNZ6vmki4KawyA79c6ts310ssC6LJ K7SMndMJvdmnT7namnPSCy2Nc9TE2hEMQBJ4dZlhXfJGJRWYQyocwrT0JZuykw3IV3tr du6ZjKajmkMrSIC8/Cklni3rPv3jczCD2w0qCKr4UZPX/ZXY6uWAlGZW/bpea5aJyssC nIP/kHHsNxeHfjc0tXszeddCRMX7xic7NZcHXDp6FLOdF8xoEdUjSiL5qa7FjA9M8hg5 mLY5qNkpGkFzQx4i1vp4TXcWtGA6c3zu0yITLxSKZ81ZkRgA7MDP4g7qShijNcTHejTI oeCA== X-Gm-Message-State: AOJu0YzDftAvRtQZAlL9Bujfpt9PDTkvUM/fxnK+WAyuZUmxDp8YW/55 MGLzJEUu9CZ+l65VNJt6NkK8QtGQpIcw9jKiraPTt3ZAG6H4KDH9bCEL7Q+wCf6EbqRBbFEz7bE cSls0/k4st3rT X-Gm-Gg: ASbGncsO+byyw+JkzaOPom6fPfwPY7B/kuHITDQrUTleAT0XwczL1HWL/ck989d+Am5 4m3ieUDURjGAmi//Mt6ksKnUhfqjWrsEWC7jvg7LnRSn9xAcNKTVb/ZnfC+ZOvKqZsxfHzl89Tp sEp33b0zMPuCvhpa4AL8KT089P7M63guUn4RomT0ODdpTrkOWrxWkRIy1ynOUHT9N0xJYeFr1Ga kiSkzVGTLnoQmsUObKMVBr/AS4/rKgaQaPAcqQ3hCUusnQgaimUBkdxeX2xBvNT2wJBass+SwZy hPH24iIy066+tNoehW3h9X1B1T3kqUsVUA0EaM/Fnd0EiKs4fk71DHjzC869dlbTU+JdvAB0etw Ba3CKQcZcQjIFhWRFifaQbwER0ALERqtAd7Ay+upWmYk0aQ== X-Google-Smtp-Source: AGHT+IFR6YtETOHXME5UTCVYA9BnYtybHSgaBrsje2Ac2b919DNqoLLF75/xSrKvZpGI8Ydel2NMKg== X-Received: by 2002:a05:6a00:3904:b0:77f:472b:bc6f with SMTP id d2e1a72fcca58-77f538e59efmr3266110b3a.13.1758627172194; Tue, 23 Sep 2025 04:32:52 -0700 (PDT) From: Minglei Liu To: qemu-devel@nongnu.org Cc: Kostiantyn Kostiuk , Michael Roth , "minglei.liu" Subject: [PATCH] qga: Improve Windows filesystem space info retrieval logic Date: Tue, 23 Sep 2025 19:32:43 +0800 Message-Id: <20250923113243.78244-1-minglei.liu@smartx.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) MIME-Version: 1.0 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::42d; envelope-from=minglei.liu@smartx.com; helo=mail-pf1-x42d.google.com X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01, URI_TRY_3LD=1.999 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @smartx-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1758627285839116600 Content-Type: text/plain; charset="utf-8" From: "minglei.liu" Previously, disk space reporting only worked for volumes with drive letters, skipping those without (e.g. System Reserved). This change always calls GetDiskFreeSpaceEx with fs->name, which is a volume GUID path. Windows APIs accept both drive letters (e.g. "C:\") and volume GUIDs (e.g. "\\?\Volume{GUID}\") as valid lpDirectoryName parameters, so space reporting is now consistent across all volumes. Reference: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file Signed-off-by: minglei.liu Reviewed-by: Kostiantyn Kostiuk --- qga/commands-win32.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 8227480810..acc2c11589 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -1164,15 +1164,15 @@ static GuestFilesystemInfo *build_guest_fsinfo(char= *guid, Error **errp) fs->mountpoint =3D g_strdup("System Reserved"); } else { fs->mountpoint =3D g_strndup(mnt_point, len); - if (GetDiskFreeSpaceEx(fs->mountpoint, - (PULARGE_INTEGER) & i64FreeBytesToCaller, - (PULARGE_INTEGER) & i64TotalBytes, - (PULARGE_INTEGER) & i64FreeBytes)) { - fs->used_bytes =3D i64TotalBytes - i64FreeBytes; - fs->total_bytes =3D i64TotalBytes; - fs->has_total_bytes =3D true; - fs->has_used_bytes =3D true; - } + } + if (GetDiskFreeSpaceEx(fs->name, + (PULARGE_INTEGER) & i64FreeBytesToCaller, + (PULARGE_INTEGER) & i64TotalBytes, + (PULARGE_INTEGER) & i64FreeBytes)) { + fs->used_bytes =3D i64TotalBytes - i64FreeBytes; + fs->total_bytes =3D i64TotalBytes; + fs->has_total_bytes =3D true; + fs->has_used_bytes =3D true; } wcstombs(fs_name, wfs_name, sizeof(wfs_name)); fs->type =3D g_strdup(fs_name); --=20 2.39.5 (Apple Git-154)