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

Ján Tomko jtomko at redhat.com
Fri Aug 8 11:07:40 UTC 2014


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 at redhat.com>
> ---
>  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140808/6a06e40d/attachment-0001.sig>


More information about the libvir-list mailing list