[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 14/14] qga-win: demystify namespace stripping
From: |
Tomáš Golembiovský |
Subject: |
[Qemu-devel] [PATCH v5 14/14] qga-win: demystify namespace stripping |
Date: |
Tue, 23 Oct 2018 13:23:23 +0200 |
It was not obvious what exactly the cryptic string copying does to the
GUID. This change makes the intent clearer.
Signed-off-by: Tomáš Golembiovský <address@hidden>
---
qga/commands-win32.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 12aba8cc50..779c8ce1fa 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -507,13 +507,21 @@ static GuestPCIAddress *get_pci_info(char *guid, Error
**errp)
char dev_name[MAX_PATH];
char *buffer = NULL;
GuestPCIAddress *pci = NULL;
- char *name = g_strdup(&guid[4]);
+ char *name = NULL;
+
pci = g_malloc0(sizeof(*pci));
pci->domain = -1;
pci->slot = -1;
pci->function = -1;
pci->bus = -1;
+ if (g_str_has_prefix(guid, "\\\\.\\") ||
+ g_str_has_prefix(guid, "\\\\?\\")) {
+ name = g_strdup(guid + 4);
+ } else {
+ name = g_strdup(guid);
+ }
+
if (!QueryDosDevice(name, dev_name, ARRAY_SIZE(dev_name))) {
error_setg_win32(errp, GetLastError(), "failed to get dos device
name");
goto out;
--
2.19.0
- [Qemu-devel] [PATCH v5 04/14] qga-win: prevent crash when executing fsinfo command, (continued)
- [Qemu-devel] [PATCH v5 04/14] qga-win: prevent crash when executing fsinfo command, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 03/14] qga: linux: return disk device in guest-get-fsinfo, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 01/14] configure: add test for libudev, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 09/14] qga-win: refactor disk properties (bus), Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 06/14] *additonal fixup for NULL pci_controller field, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 11/14] qga-win: refactor disk info, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 10/14] qga-win: report disk serial number, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 07/14] build: rename CONFIG_QGA_NTDDDISK to CONFIG_QGA_NTDDSCSI, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 08/14] qga-win: add debugging information, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 12/14] qga-win: handle multi-disk volumes, Tomáš Golembiovský, 2018/10/23
- [Qemu-devel] [PATCH v5 14/14] qga-win: demystify namespace stripping,
Tomáš Golembiovský <=
- [Qemu-devel] [PATCH v5 13/14] qga-win: return disk device in guest-get-fsinfo, Tomáš Golembiovský, 2018/10/23
- Re: [Qemu-devel] [PATCH v5 00/14] qga: report serial number and disk node, Michael Roth, 2018/10/29