[libvirt] [PATCH 2/2] vmx: handle shared folders parsing
Matthias Bolte
matthias.bolte at googlemail.com
Sat Jul 21 18:18:48 UTC 2012
2012/7/11 Jean-Baptiste Rouault <jean-baptiste.rouault at diateam.net>:
> This patch adds support for parsing vmx files with
> shared folders enabled.
>
> Update test suite accordingly.
> ---
> src/vmx/vmx.c | 134 +++++++++++++++++++++++++++-
> src/vmx/vmx.h | 2 +
> tests/vmx2xmldata/vmx2xml-sharedfolder.vmx | 9 ++
> tests/vmx2xmldata/vmx2xml-sharedfolder.xml | 22 +++++
> tests/vmx2xmltest.c | 2 +
> 5 files changed, 168 insertions(+), 1 deletion(-)
> create mode 100644 tests/vmx2xmldata/vmx2xml-sharedfolder.vmx
> create mode 100644 tests/vmx2xmldata/vmx2xml-sharedfolder.xml
>
> +int virVMXParseFileSystem(virConfPtr conf, int index, virDomainFSDefPtr *def)
I'll replace index with number here again as it shadows a global.
> + /* vmx:hostPath */
> + if (virVMXGetConfigString(conf, hostPath_name, &hostPath, false) < 0) {
> + goto cleanup;
> + }
> +
> + (*def)->src = strdup(hostPath);
> +
> + /* vmx:guestName */
> + if (virVMXGetConfigString(conf, guestName_name, &guestName, false) < 0) {
> + goto cleanup;
> + }
> +
> + (*def)->dst = strdup(guestName);
The result of strdup must be check for NULL. But there is no need to
strdup it here as hostPath can just be stolen:
(*def)->src = hostPath;
hostPath = NULL;
ACK and pushed with the mentioned changes.
--
Matthias Bolte
http://photron.blogspot.com
More information about the libvir-list
mailing list