diff options
author | Peter Maydell | 2018-07-05 09:21:25 +0200 |
---|---|---|
committer | Peter Maydell | 2018-07-05 09:21:25 +0200 |
commit | 8beb8cc64da2868acec270e4becb9fea8f9093dc (patch) | |
tree | e52359adc3fb84e4fab87ef7306ae4fe6f0cd4d9 /qga/commands-win32.c | |
parent | Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-re... (diff) | |
parent | qga: removing bios_supports_mode (diff) | |
download | qemu-8beb8cc64da2868acec270e4becb9fea8f9093dc.tar.gz qemu-8beb8cc64da2868acec270e4becb9fea8f9093dc.tar.xz qemu-8beb8cc64da2868acec270e4becb9fea8f9093dc.zip |
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2018-07-03-tag' into staging
qemu-ga patch queue for soft-freeze
* add systemd suspend support
* add used/total space stats for guest-get-fsinfo
* fixes for guest-get-fsinfo over PCI bridges
* MSI installer and schema doc fixes
* guard against unbounded allocations in guest-file-read
* add some additional qga test cases
# gpg: Signature made Tue 03 Jul 2018 21:45:32 BST
# gpg: using RSA key 3353C9CEF108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
# gpg: aka "Michael Roth <mdroth@utexas.edu>"
# gpg: aka "Michael Roth <mdroth@linux.vnet.ibm.com>"
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D 3FA0 3353 C9CE F108 B584
* remotes/mdroth/tags/qga-pull-2018-07-03-tag:
qga: removing bios_supports_mode
qga: systemd hibernate/suspend/hybrid-sleep support
qga: removing switch statements, adding run_process_child
qga: guest_suspend: decoupling pm-utils and sys logic
qga: bios_supports_mode: decoupling pm-utils and sys logic
qga: refactoring qmp_guest_suspend_* functions
qemu-ga: make get-fsinfo work over pci bridges
qga-win: Fixing msi upgrade disallow in WiX file
qga/schema: fix documentation for GuestOSInfo
test-qga: add trivial tests for some commands
qga-win: add driver path usage to GuestFilesystemInfo
qga: add mountpoint usage info to GuestFilesystemInfo
qga: check bytes count read by guest-file-read
qga: unset frozen state if no mount points are frozen
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qga/commands-win32.c')
-rw-r--r-- | qga/commands-win32.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 70ee5379f6..318d760a74 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -318,7 +318,7 @@ GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, } if (!has_count) { count = QGA_READ_COUNT_DEFAULT; - } else if (count < 0) { + } else if (count < 0 || count >= UINT32_MAX) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); return NULL; @@ -670,6 +670,7 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp) char fs_name[32]; char vol_info[MAX_PATH+1]; size_t len; + uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; GuestFilesystemInfo *fs = NULL; GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size); @@ -699,10 +700,21 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp) fs_name[sizeof(fs_name) - 1] = 0; fs = g_malloc(sizeof(*fs)); fs->name = g_strdup(guid); + fs->has_total_bytes = false; + fs->has_used_bytes = false; if (len == 0) { fs->mountpoint = g_strdup("System Reserved"); } else { fs->mountpoint = g_strndup(mnt_point, len); + if (GetDiskFreeSpaceEx(fs->mountpoint, + (PULARGE_INTEGER) & i64FreeBytesToCaller, + (PULARGE_INTEGER) & i64TotalBytes, + (PULARGE_INTEGER) & i64FreeBytes)) { + fs->used_bytes = i64TotalBytes - i64FreeBytes; + fs->total_bytes = i64TotalBytes; + fs->has_total_bytes = true; + fs->has_used_bytes = true; + } } fs->type = g_strdup(fs_name); fs->disk = build_guest_disk_info(guid, errp); |