From: Konstantin Kostiuk <kkostiuk@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PULL 3/4] qga-win: Fix guest-get-fsinfo multi-disks collection
Date: Tue, 30 Jan 2024 12:58:55 +0200 [thread overview]
Message-ID: <20240130105856.27178-4-kkostiuk@redhat.com> (raw)
In-Reply-To: <20240130105856.27178-1-kkostiuk@redhat.com>
From: Peng Ji <peng.ji@smartx.com>
When a volume has more than one disk, all disks cannot be
returned correctly because there is not enough malloced memory
for disk extents, so before executing DeviceIoControl for the
second time, get the correct size of the required memory space
to store all disk extents.
Details:
https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-volume_disk_extents
Signed-off-by: Peng Ji <peng.ji@smartx.com>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
qga/commands-win32.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 697c65507c..a1015757d8 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -935,6 +935,8 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
DWORD last_err = GetLastError();
if (last_err == ERROR_MORE_DATA) {
/* Try once more with big enough buffer */
+ size = sizeof(VOLUME_DISK_EXTENTS) +
+ (sizeof(DISK_EXTENT) * (extents->NumberOfDiskExtents - 1));
g_free(extents);
extents = g_malloc0(size);
if (!DeviceIoControl(
--
2.42.0
next prev parent reply other threads:[~2024-01-30 11:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 10:58 [PULL 0/4] Misc changes guest agent Konstantin Kostiuk
2024-01-30 10:58 ` [PULL 1/4] guest-agent: improve help for --allow-rpcs and --block-rpcs Konstantin Kostiuk
2024-01-30 10:58 ` [PULL 2/4] tests/unit/test-qga: do not qualify executable paths Konstantin Kostiuk
2024-01-30 10:58 ` Konstantin Kostiuk [this message]
2024-01-30 10:58 ` [PULL 4/4] qga: Solaris has net/if_arp.h and netinet/if_ether.h but not ETHER_ADDR_LEN Konstantin Kostiuk
2024-01-31 19:52 ` [PULL 0/4] Misc changes guest agent Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240130105856.27178-4-kkostiuk@redhat.com \
--to=kkostiuk@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).