Re: [PATCHv5 12/19] storage: Don't store parent directory of an image explicitly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]