From: "Tomáš Golembiovský" <tgolembi@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eric Blake" <eblake@redhat.com>,
"Sameeh Jubran" <sjubran@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Olga Krishtal" <okrishtal@virtuozzo.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Tomáš Golembiovský" <tgolembi@redhat.com>
Subject: [Qemu-devel] [PATCH v5 14/14] qga-win: demystify namespace stripping
Date: Tue, 23 Oct 2018 13:23:23 +0200 [thread overview]
Message-ID: <f41ccdea9e33e09fc014b1db8111b45d15592a85.1540293796.git.tgolembi@redhat.com> (raw)
In-Reply-To: <cover.1540293795.git.tgolembi@redhat.com>
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ý <tgolembi@redhat.com>
---
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
next prev parent reply other threads:[~2018-10-23 11:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 11:23 [Qemu-devel] [PATCH v5 00/14] qga: report serial number and disk node Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 01/14] configure: add test for libudev Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 02/14] qga: linux: report disk serial number Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 03/14] qga: linux: return disk device in guest-get-fsinfo Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 04/14] qga-win: prevent crash when executing fsinfo command Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 05/14] qga-win: fsinfo: pci-info: allow partial info Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 06/14] *additonal fixup for NULL pci_controller field Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 07/14] build: rename CONFIG_QGA_NTDDDISK to CONFIG_QGA_NTDDSCSI Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 08/14] qga-win: add debugging information Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 09/14] qga-win: refactor disk properties (bus) Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 10/14] qga-win: report disk serial number Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 11/14] qga-win: refactor disk info Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 12/14] qga-win: handle multi-disk volumes Tomáš Golembiovský
2018-10-23 11:23 ` [Qemu-devel] [PATCH v5 13/14] qga-win: return disk device in guest-get-fsinfo Tomáš Golembiovský
2018-10-23 11:23 ` Tomáš Golembiovský [this message]
2018-10-30 3:27 ` [Qemu-devel] [PATCH v5 00/14] qga: report serial number and disk node Michael Roth
2018-10-30 10:00 ` Tomáš Golembiovský
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f41ccdea9e33e09fc014b1db8111b45d15592a85.1540293796.git.tgolembi@redhat.com \
--to=tgolembi@redhat.com \
--cc=eblake@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=okrishtal@virtuozzo.com \
--cc=qemu-devel@nongnu.org \
--cc=sjubran@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).