aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomáš Golembiovský <tgolembi@redhat.com>2018-10-23 13:23:22 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2018-10-31 09:04:20 -0500
commit4550dee80fc1bba37bce141a3d6f83c3e390e719 (patch)
tree6d70dde135656fcc55f0fbc46d4b4ff1848212c8
parentb1ba8890e63ce9432c41c5c3fc229f54c87c9c99 (diff)
downloadqemu-4550dee80fc1bba37bce141a3d6f83c3e390e719.zip
qemu-4550dee80fc1bba37bce141a3d6f83c3e390e719.tar.gz
qemu-4550dee80fc1bba37bce141a3d6f83c3e390e719.tar.bz2
qga-win: return disk device in guest-get-fsinfo
Report device UNC of the disk. It is reported as "\\.\PhysicalDriveX". Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--qga/commands-win32.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 90432bb..30d6c63 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -684,8 +684,7 @@ out_free:
return;
}
-static void get_single_disk_info(char *name, GuestDiskAddress *disk,
- Error **errp)
+static void get_single_disk_info(GuestDiskAddress *disk, Error **errp)
{
SCSI_ADDRESS addr, *scsi_ad;
DWORD len;
@@ -694,8 +693,8 @@ static void get_single_disk_info(char *name, GuestDiskAddress *disk,
scsi_ad = &addr;
- g_debug("getting disk info for: %s", name);
- disk_h = CreateFile(name, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ g_debug("getting disk info for: %s", disk->dev);
+ disk_h = CreateFile(disk->dev, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING,
0, NULL);
if (disk_h == INVALID_HANDLE_VALUE) {
error_setg_win32(errp, GetLastError(), "failed to open disk");
@@ -714,7 +713,7 @@ static void get_single_disk_info(char *name, GuestDiskAddress *disk,
* if that doesn't hold since that suggests some other unexpected
* breakage
*/
- disk->pci_controller = get_pci_info(name, &local_err);
+ disk->pci_controller = get_pci_info(disk->dev, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto err_close;
@@ -797,7 +796,9 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
/* Possibly CD-ROM or a shared drive. Try to pass the volume */
g_debug("volume not on disk");
disk = g_malloc0(sizeof(GuestDiskAddress));
- get_single_disk_info(name, disk, &local_err);
+ disk->has_dev = true;
+ disk->dev = g_strdup(name);
+ get_single_disk_info(disk, &local_err);
if (local_err) {
g_debug("failed to get disk info, ignoring error: %s",
error_get_pretty(local_err));
@@ -819,7 +820,6 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
/* Go through each extent */
for (i = 0; i < extents->NumberOfDiskExtents; i++) {
- char *disk_name = NULL;
disk = g_malloc0(sizeof(GuestDiskAddress));
/* Disk numbers directly correspond to numbers used in UNCs
@@ -830,10 +830,11 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
* See also Naming Files, Paths and Namespaces:
* https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#win32-device-namespaces
*/
- disk_name = g_strdup_printf("\\\\.\\PhysicalDrive%lu",
+ disk->has_dev = true;
+ disk->dev = g_strdup_printf("\\\\.\\PhysicalDrive%lu",
extents->Extents[i].DiskNumber);
- get_single_disk_info(disk_name, disk, &local_err);
- g_free(disk_name);
+
+ get_single_disk_info(disk, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto out;