]> err.no Git - systemd/commitdiff
util: introduce fstype_is_network()
authorLennart Poettering <lennart@poettering.net>
Sat, 10 Apr 2010 15:41:34 +0000 (17:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 10 Apr 2010 16:00:33 +0000 (18:00 +0200)
util.c
util.h

diff --git a/util.c b/util.c
index 52ca5e25631a9e56f8fd5e27df7c63d777b6d50a..f3161bd7f3e888b4a4b34e8ded2b1a4fde652f13 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1276,6 +1276,24 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
         return buf;
 }
 
+bool fstype_is_network(const char *fstype) {
+        static const char * const table[] = {
+                "cifs",
+                "smbfs",
+                "ncpfs",
+                "nfs",
+                "nfs4"
+        };
+
+        unsigned i;
+
+        for (i = 0; i < ELEMENTSOF(table); i++)
+                if (streq(table[i], fstype))
+                        return true;
+
+        return false;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",
diff --git a/util.h b/util.h
index df2f3f79663b9396bee47313f19f3975b482d5e6..a716d8a57eaa4e69d720d95afd276b856d2b81b8 100644 (file)
--- a/util.h
+++ b/util.h
@@ -196,6 +196,8 @@ int fd_cloexec(int fd, bool cloexec);
 
 int close_all_fds(const int except[], unsigned n_except);
 
+bool fstype_is_network(const char *fstype);
+
 extern char * __progname;
 
 const char *ioprio_class_to_string(int i);