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

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



Use the virFileGetFSFtype() in order to compare the returned
f_type for the NFS super magic number

Signed-off-by: John Ferlan <jferlan 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)
+{
+    /* 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);
 int virFileIsSharedFS(const char *path) ATTRIBUTE_NONNULL(1);
 int virFileIsMountPoint(const char *file) ATTRIBUTE_NONNULL(1);
 
-- 
1.9.3


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