Re: [PATCH 2/4] virfile: Introduce virFileIsNFSFSType

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

 



On 08/05/2014 04:38 PM, John Ferlan wrote:
> Use the virFileGetFSFtype() in order to compare the returned
> f_type for the NFS super magic number
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/libvirt_private.syms |  1 +
>  src/util/virfile.c       | 19 +++++++++++++++++++
>  src/util/virfile.h       |  1 +
>  3 files changed, 21 insertions(+)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 08111d4..121e578 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1291,6 +1291,7 @@ virFileIsDir;
>  virFileIsExecutable;
>  virFileIsLink;
>  virFileIsMountPoint;
> +virFileIsNFSFSType;
>  virFileIsSharedFS;
>  virFileIsSharedFSType;
>  virFileLinkPointsTo;
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index 7612007..e6c767d 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -2927,6 +2927,18 @@ virFileIsSharedFSType(const char *path,
>      return 0;
>  }
>  
> +bool
> +virFileIsNFSFSType(const char *path)
> +{
> +    long long int f_type;
> +
> +    if ((virFileGetFSFtype(path, &f_type) == 0) &&
> +        (f_type == NFS_SUPER_MAGIC))
> +        return true;
> +
> +    return false;
> +}
> +
>  int
>  virFileGetHugepageSize(const char *path,
>                         unsigned long long *size)
> @@ -3060,6 +3072,13 @@ int virFileIsSharedFSType(const char *path ATTRIBUTE_UNUSED,
>  }
>  
>  int
> +virFileIsNFSFSType(const char *path ATTRIBUTE_UNUSED)

This doesn't match the prototype in virfile.h.

Also, I wonder if virFileIsNFSFSType(path) is that much more readable than
virFileIsSharedFSType(path, VIR_FILE_SHFS_NFS) == 1.

> +{
> +    /* XXX implement me :-) */
> +    return false;
> +}
> +
> +int
>  virFileGetHugepageSize(const char *path ATTRIBUTE_UNUSED,
>                         unsigned long long *size ATTRIBUTE_UNUSED)
>  {
> diff --git a/src/util/virfile.h b/src/util/virfile.h
> index 403d0ba..cc07c53 100644
> --- a/src/util/virfile.h
> +++ b/src/util/virfile.h
> @@ -191,6 +191,7 @@ enum {
>  };
>  
>  int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL(1);
> +bool virFileIsNFSFSType(const char *path);

ATTRIBUTE_NONNULL(1);

>  int virFileIsSharedFS(const char *path) ATTRIBUTE_NONNULL(1);
>  int virFileIsMountPoint(const char *file) ATTRIBUTE_NONNULL(1);
>  
> 

ACK

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]