[libvirt] [PATCHv5 12/19] storage: Don't store parent directory of an image explicitly
Eric Blake
eblake at redhat.com
Tue Jun 24 22:59:21 UTC 2014
On 06/19/2014 07:59 AM, Peter Krempa wrote:
> The parent directory doesn't necessarily need to be stored after we
> don't mangle the path stored in the image. Remove it and tweak the code
> to avoid using it.
> ---
> src/storage/storage_driver.c | 11 ++-----
> src/util/virstoragefile.c | 68 ++++++++++++++++++--------------------------
> src/util/virstoragefile.h | 3 --
> tests/virstoragetest.c | 21 --------------
> 4 files changed, 30 insertions(+), 73 deletions(-)
>
> @@ -1372,8 +1373,20 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
> break;
> if (nameIsFile && (chain->type == VIR_STORAGE_TYPE_FILE ||
> chain->type == VIR_STORAGE_TYPE_BLOCK)) {
> + if (prev) {
> + if (!(parentDir = mdir_name(prev->path))) {
> + virReportOOMError();
> + goto error;
> + }
> + } else {
> + if (VIR_STRDUP(parentDir, ".") < 0)
> + goto error;
> + }
> +
> int result = virFileRelLinkPointsTo(parentDir, name,
> chain->path);
Maybe you could make virFileRelLinkPointsTo gracefully handle
parentDir==NULL as meaning to start from the current directory, and then
you wouldn't have to strdup(".") here. But if you do that, make it a
separate patch. I'm fine with this one as-is.
ACK
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140624/6b74bcd5/attachment-0001.sig>
More information about the libvir-list
mailing list