qemu-ga patch queue for hard-freeze
* document use of -1 when pci_controller field can't be retrieved for guest-get-fsinfo * fix incorrect filesystem type reporting on w32 for guest-get-fsinfo when a volume is not mounted -----BEGIN PGP SIGNATURE----- iQFOBAABCgA4FiEEzqzJ4VU066u4LT+gM1PJzvEItYQFAl8fYGIaHG1kcm90aEBs aW51eC52bmV0LmlibS5jb20ACgkQM1PJzvEItYTOKgf9G5mM8cXW0MxKevy4Fc1Q i6+/VGkvAUURxn6PALGl4an8sLA0E2uzgqZr3+IWZY+85DZmJ18tfj4QU9G/M9w0 4ByTksmvVR66ukwR0H6lN38cdqxTxzFqeAyuU2WWucYeyGl1l2QMlES2OUqlcgcq 297/ivLRTnUGGe2Ts5EfCNMS2RGExJxbPhq9ffhNYbas92Pu/e2nm0X5uHJpMHiW TFw/cQ1EnSxxDtNnKJD7VnC/tlZxKKP/qXwJAgoDxW7ORB1XRxCLrSNkRRLBXMxV F1VksXS4GAIc50nKTb2qHtexLebAjjrJW5c6iJAjWkKJlxhJbpcvXjo6d31Sri5D 6Q== =Y/oG -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2020-07-27-tag' into staging qemu-ga patch queue for hard-freeze * document use of -1 when pci_controller field can't be retrieved for guest-get-fsinfo * fix incorrect filesystem type reporting on w32 for guest-get-fsinfo when a volume is not mounted # gpg: Signature made Tue 28 Jul 2020 00:16:50 BST # gpg: using RSA key CEACC9E15534EBABB82D3FA03353C9CEF108B584 # gpg: issuer "mdroth@linux.vnet.ibm.com" # gpg: Good signature from "Michael Roth <flukshun@gmail.com>" [full] # gpg: aka "Michael Roth <mdroth@utexas.edu>" [full] # gpg: aka "Michael Roth <mdroth@linux.vnet.ibm.com>" [full] # Primary key fingerprint: CEAC C9E1 5534 EBAB B82D 3FA0 3353 C9CE F108 B584 * remotes/mdroth/tags/qga-pull-2020-07-27-tag: qga/qapi-schema: Document -1 for invalid PCI address fields qga-win: fix "guest-get-fsinfo" wrong filesystem type Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
1e0e0917e5
@ -958,11 +958,13 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
|
|||||||
{
|
{
|
||||||
DWORD info_size;
|
DWORD info_size;
|
||||||
char mnt, *mnt_point;
|
char mnt, *mnt_point;
|
||||||
|
wchar_t wfs_name[32];
|
||||||
char fs_name[32];
|
char fs_name[32];
|
||||||
char vol_info[MAX_PATH+1];
|
wchar_t vol_info[MAX_PATH + 1];
|
||||||
size_t len;
|
size_t len;
|
||||||
uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes;
|
uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes;
|
||||||
GuestFilesystemInfo *fs = NULL;
|
GuestFilesystemInfo *fs = NULL;
|
||||||
|
HANDLE hLocalDiskHandle = NULL;
|
||||||
|
|
||||||
GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size);
|
GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size);
|
||||||
if (GetLastError() != ERROR_MORE_DATA) {
|
if (GetLastError() != ERROR_MORE_DATA) {
|
||||||
@ -977,18 +979,27 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
|
|||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hLocalDiskHandle = CreateFile(guid, 0 , 0, NULL, OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL |
|
||||||
|
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||||
|
if (INVALID_HANDLE_VALUE == hLocalDiskHandle) {
|
||||||
|
error_setg_win32(errp, GetLastError(), "failed to get handle for volume");
|
||||||
|
goto free;
|
||||||
|
}
|
||||||
|
|
||||||
len = strlen(mnt_point);
|
len = strlen(mnt_point);
|
||||||
mnt_point[len] = '\\';
|
mnt_point[len] = '\\';
|
||||||
mnt_point[len+1] = 0;
|
mnt_point[len+1] = 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_name))) {
|
||||||
if (GetLastError() != ERROR_NOT_READY) {
|
if (GetLastError() != ERROR_NOT_READY) {
|
||||||
error_setg_win32(errp, GetLastError(), "failed to get volume info");
|
error_setg_win32(errp, GetLastError(), "failed to get volume info");
|
||||||
}
|
}
|
||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs_name[sizeof(fs_name) - 1] = 0;
|
|
||||||
fs = g_malloc(sizeof(*fs));
|
fs = g_malloc(sizeof(*fs));
|
||||||
fs->name = g_strdup(guid);
|
fs->name = g_strdup(guid);
|
||||||
fs->has_total_bytes = false;
|
fs->has_total_bytes = false;
|
||||||
@ -1007,9 +1018,11 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
|
|||||||
fs->has_used_bytes = true;
|
fs->has_used_bytes = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wcstombs(fs_name, wfs_name, sizeof(wfs_name));
|
||||||
fs->type = g_strdup(fs_name);
|
fs->type = g_strdup(fs_name);
|
||||||
fs->disk = build_guest_disk_info(guid, errp);
|
fs->disk = build_guest_disk_info(guid, errp);
|
||||||
free:
|
free:
|
||||||
|
CloseHandle(hLocalDiskHandle);
|
||||||
g_free(mnt_point);
|
g_free(mnt_point);
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
@ -1027,8 +1040,12 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
GuestFilesystemInfo *info = build_guest_fsinfo(guid, errp);
|
Error *local_err = NULL;
|
||||||
if (info == NULL) {
|
GuestFilesystemInfo *info = 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;
|
continue;
|
||||||
}
|
}
|
||||||
new = g_malloc(sizeof(*ret));
|
new = g_malloc(sizeof(*ret));
|
||||||
|
@ -846,7 +846,7 @@
|
|||||||
##
|
##
|
||||||
# @GuestDiskAddress:
|
# @GuestDiskAddress:
|
||||||
#
|
#
|
||||||
# @pci-controller: controller's PCI address
|
# @pci-controller: controller's PCI address (fields are set to -1 if invalid)
|
||||||
# @bus-type: bus type
|
# @bus-type: bus type
|
||||||
# @bus: bus id
|
# @bus: bus id
|
||||||
# @target: target id
|
# @target: target id
|
||||||
|
Loading…
Reference in New Issue
Block a user