[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5.1 2/2] qga-win: add driver path usage to Gues
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5.1 2/2] qga-win: add driver path usage to GuestFilesystemInfo |
Date: |
Fri, 1 Jun 2018 12:15:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 06/01/2018 11:57 AM, Chen Hanxiao wrote:
From: Chen Hanxiao <address@hidden>
This patch adds support for getting the usage of
windows driver path.
The usage of fs stored as used_bytes and total_bytes.
Cc: Michael Roth <address@hidden>
Signed-off-by: Chen Hanxiao <address@hidden>
---
v2:
unpack usage as used-bytes and total-bytes
@@ -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;
Dead assignments.
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;
+ }
I'm less familiar with Windows API, so I won't give this R-b. But now
that I read this patch, I do have a question: since both statvfs() and
GetDiskFreeSpaceEx() give you free bytes rather than used bytes, and you
had to perform a subtraction to report 'used-bytes' over QGA, would it
make any more sense to instead report 'free-bytes' over QGA for less
subtraction work on your end and so that the QGA interface is more
similar to existing interfaces?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org