On Thu, May 03, 2018 at 12:54:15PM +0200, Andrea Bolognani wrote:
> It's a trivial wrapper around canonicalize_file_name(),
> which we need in order to fully mock file access on non-Linux
> platforms.
>
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
> src/libvirt_private.syms | 1 +
> src/util/virfile.c | 13 +++++++++++++
> src/util/virfile.h | 1 +
> 3 files changed, 15 insertions(+)
>
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index d2728749fb..cbf27ffa05 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1761,6 +1761,7 @@ virFileAccessibleAs;
> virFileActivateDirOverride;
> virFileBindMountDevice;
> virFileBuildPath;
> +virFileCanonicalizePath;
> virFileClose;
> virFileComparePaths;
> virFileCopyACLs;
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index e12a584ca1..2a16b01ae5 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -3299,6 +3299,19 @@ virFileSanitizePath(const char *path)
> return cleanpath;
> }
>
> +/**
> + * virFileCanonicalizePath:
> + *
> + * Returns the canonical representation of @path.
> + *
> + * The returned string must be freed after use.
> + */
> +char *
> +virFileCanonicalizePath(const char *path)
> +{
> + return canonicalize_file_name(path);
> +}
> +
> /**
> * virFileRemoveLastComponent:
> *
> diff --git a/src/util/virfile.h b/src/util/virfile.h
> index cd2a3867c2..341320b3d3 100644
> --- a/src/util/virfile.h
> +++ b/src/util/virfile.h
> @@ -218,6 +218,7 @@ int virFileGetMountReverseSubtree(const char *mtabpath,
> size_t *nmountsret) ATTRIBUTE_RETURN_CHECK;
>
> char *virFileSanitizePath(const char *path);
> +char *virFileCanonicalizePath(const char *path) ATTRIBUTE_NOINLINE;
ATTRIBUTE_NOINLINE feels wierd, but I guess it is needed in virfile.c
uses the method
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list