* [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze @ 2020-07-27 23:22 Michael Roth 2020-07-27 23:22 ` [PULL for-5.1 1/2] qga-win: fix "guest-get-fsinfo" wrong filesystem type Michael Roth ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Michael Roth @ 2020-07-27 23:22 UTC (permalink / raw) To: qemu-devel; +Cc: peter.maydell The following changes since commit 9303ecb658a0194560d1eecde165a1511223c2d8: Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200727' into staging (2020-07-27 17:25:06 +0100) are available in the Git repository at: git://github.com/mdroth/qemu.git tags/qga-pull-2020-07-27-tag for you to fetch changes up to ba620541d0db7e3433babbd97c0413a371e6fb4a: qga/qapi-schema: Document -1 for invalid PCI address fields (2020-07-27 18:03:55 -0500) ---------------------------------------------------------------- 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 ---------------------------------------------------------------- Basil Salman (1): qga-win: fix "guest-get-fsinfo" wrong filesystem type Thomas Huth (1): qga/qapi-schema: Document -1 for invalid PCI address fields qga/commands-win32.c | 29 +++++++++++++++++++++++------ qga/qapi-schema.json | 2 +- 2 files changed, 24 insertions(+), 7 deletions(-) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PULL for-5.1 1/2] qga-win: fix "guest-get-fsinfo" wrong filesystem type 2020-07-27 23:22 [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze Michael Roth @ 2020-07-27 23:22 ` Michael Roth 2020-07-27 23:22 ` [PULL for-5.1 2/2] qga/qapi-schema: Document -1 for invalid PCI address fields Michael Roth 2020-07-28 15:27 ` [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze Peter Maydell 2 siblings, 0 replies; 4+ messages in thread From: Michael Roth @ 2020-07-27 23:22 UTC (permalink / raw) To: qemu-devel; +Cc: peter.maydell, Basil Salman, Basil Salman From: Basil Salman <bsalman@redhat.com> This patch handles the case where unmounted volumes exist, where in that case GetVolumePathNamesForVolumeName returns empty path, GetVolumeInformation will use the current working directory instead. This patch fixes the issue by opening a handle to the volumes, and using GetVolumeInformationByHandleW instead. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1746667 Signed-off-by: Basil Salman <bsalman@redhat.com> Signed-off-by: Basil Salman <basil@daynix.com> *fix crash when guest_build_fsinfo() sets errp multiple times *make new error message more distinct from existing ones Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> --- qga/commands-win32.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index aaa71f147b..15c9d7944b 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -958,11 +958,13 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp) { DWORD info_size; char mnt, *mnt_point; + wchar_t wfs_name[32]; char fs_name[32]; - char vol_info[MAX_PATH+1]; + wchar_t vol_info[MAX_PATH + 1]; size_t len; uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; GuestFilesystemInfo *fs = NULL; + HANDLE hLocalDiskHandle = NULL; GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size); if (GetLastError() != ERROR_MORE_DATA) { @@ -977,18 +979,27 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp) 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); mnt_point[len] = '\\'; 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) { error_setg_win32(errp, GetLastError(), "failed to get volume info"); } goto free; } - fs_name[sizeof(fs_name) - 1] = 0; fs = g_malloc(sizeof(*fs)); fs->name = g_strdup(guid); fs->has_total_bytes = false; @@ -1007,9 +1018,11 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp) fs->has_used_bytes = true; } } + wcstombs(fs_name, wfs_name, sizeof(wfs_name)); fs->type = g_strdup(fs_name); fs->disk = build_guest_disk_info(guid, errp); free: + CloseHandle(hLocalDiskHandle); g_free(mnt_point); return fs; } @@ -1027,8 +1040,12 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp) } do { - GuestFilesystemInfo *info = build_guest_fsinfo(guid, errp); - if (info == NULL) { + Error *local_err = 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; } new = g_malloc(sizeof(*ret)); -- 2.17.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PULL for-5.1 2/2] qga/qapi-schema: Document -1 for invalid PCI address fields 2020-07-27 23:22 [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze Michael Roth 2020-07-27 23:22 ` [PULL for-5.1 1/2] qga-win: fix "guest-get-fsinfo" wrong filesystem type Michael Roth @ 2020-07-27 23:22 ` Michael Roth 2020-07-28 15:27 ` [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze Peter Maydell 2 siblings, 0 replies; 4+ messages in thread From: Michael Roth @ 2020-07-27 23:22 UTC (permalink / raw) To: qemu-devel; +Cc: peter.maydell, Thomas Huth From: Thomas Huth <thuth@redhat.com> The "guest-get-fsinfo" could also be used for non-PCI devices in the future. And the code in GuestPCIAddress() in qga/commands-win32.c seems to be using "-1" for fields that it can not determine already. Thus let's properly document "-1" as value for invalid PCI address fields. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> --- qga/qapi-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 4be9aad48e..408a662ea5 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -846,7 +846,7 @@ ## # @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: bus id # @target: target id -- 2.17.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze 2020-07-27 23:22 [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze Michael Roth 2020-07-27 23:22 ` [PULL for-5.1 1/2] qga-win: fix "guest-get-fsinfo" wrong filesystem type Michael Roth 2020-07-27 23:22 ` [PULL for-5.1 2/2] qga/qapi-schema: Document -1 for invalid PCI address fields Michael Roth @ 2020-07-28 15:27 ` Peter Maydell 2 siblings, 0 replies; 4+ messages in thread From: Peter Maydell @ 2020-07-28 15:27 UTC (permalink / raw) To: Michael Roth; +Cc: QEMU Developers On Tue, 28 Jul 2020 at 00:23, Michael Roth <mdroth@linux.vnet.ibm.com> wrote: > > The following changes since commit 9303ecb658a0194560d1eecde165a1511223c2d8: > > Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200727' into staging (2020-07-27 17:25:06 +0100) > > are available in the Git repository at: > > git://github.com/mdroth/qemu.git tags/qga-pull-2020-07-27-tag > > for you to fetch changes up to ba620541d0db7e3433babbd97c0413a371e6fb4a: > > qga/qapi-schema: Document -1 for invalid PCI address fields (2020-07-27 18:03:55 -0500) > > ---------------------------------------------------------------- > 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 > Applied, thanks. Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1 for any user-visible changes. -- PMM ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-28 15:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-07-27 23:22 [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze Michael Roth 2020-07-27 23:22 ` [PULL for-5.1 1/2] qga-win: fix "guest-get-fsinfo" wrong filesystem type Michael Roth 2020-07-27 23:22 ` [PULL for-5.1 2/2] qga/qapi-schema: Document -1 for invalid PCI address fields Michael Roth 2020-07-28 15:27 ` [PULL for-5.1 0/2] qemu-ga patch queue for hard-freeze Peter Maydell
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).