Re: [libvirt PATCH 09/17] virstoragefile: move virStorageIsFile into virfile

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

 



On Mon, Dec 14, 2020 at 16:55:29 +0100, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  src/libvirt_private.syms  |  2 +-
>  src/util/virfile.c        | 21 +++++++++++++++++++++
>  src/util/virfile.h        |  1 +
>  src/util/virstoragefile.c | 26 +++-----------------------
>  src/util/virstoragefile.h |  1 -
>  5 files changed, 26 insertions(+), 25 deletions(-)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 57f3b12000..0b560dfe45 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -2090,6 +2090,7 @@ virFileIsCDROM;
>  virFileIsClusterFS;
>  virFileIsDir;
>  virFileIsExecutable;
> +virFileIsFile;

This doesn't really belong here. virFileIs* checks an actual file, while
the function checks only the filename to conform to some rules.

Additionally ...

>  virFileIsLink;
>  virFileIsMountPoint;
>  virFileIsRegular;
> @@ -3156,7 +3157,6 @@ virStorageFileSupportsBackingChainTraversal;
>  virStorageFileSupportsCreate;
>  virStorageFileSupportsSecurityDriver;
>  virStorageFileUnlink;
> -virStorageIsFile;
>  virStorageIsRelative;
>  virStorageNetHostDefClear;
>  virStorageNetHostDefCopy;

[...]

> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index 3db85d8b89..f37802260b 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c

[...]

> @@ -783,7 +763,7 @@ virStorageIsRelative(const char *backing)
>      if (backing[0] == '/')
>          return false;
>  
> -    if (!virStorageIsFile(backing))
> +    if (!virFileIsFile(backing))

... all uses ...

>          return false;
>  
>      return true;
> @@ -1450,7 +1430,7 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
>  {
>      virStorageSourcePtr prev;
>      const char *start = chain->path;
> -    bool nameIsFile = virStorageIsFile(name);
> +    bool nameIsFile = virFileIsFile(name);

... are within ...

>  
>      if (!parent)
>          parent = &prev;
> @@ -3794,7 +3774,7 @@ virStorageSourceNewFromBackingAbsolute(const char *path,
>  
>      *src = NULL;
>  
> -    if (virStorageIsFile(path)) {
> +    if (virFileIsFile(path)) {

... this one file. Just unexport it and keep it here, since it's only
relevant to backing chain traversal.

>          def->type = VIR_STORAGE_TYPE_FILE;
>  
>          def->path = g_strdup(path);

You can use my R-b on the patch which unexports it.

NACK to this movement.




[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]

  Powered by Linux