]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stat-util: introduce path_is_network_fs()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 4 Feb 2022 06:22:20 +0000 (15:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 4 Feb 2022 06:22:20 +0000 (15:22 +0900)
src/basic/stat-util.c
src/basic/stat-util.h

index efac7b002e4182bbb96aa9abaadfa39bbf9b20d9..c2269844f816dd7c871a91cc70ffaa4c91ca614b 100644 (file)
@@ -249,6 +249,15 @@ int path_is_temporary_fs(const char *path) {
         return is_temporary_fs(&s);
 }
 
+int path_is_network_fs(const char *path) {
+        struct statfs s;
+
+        if (statfs(path, &s) < 0)
+                return -errno;
+
+        return is_network_fs(&s);
+}
+
 int stat_verify_regular(const struct stat *st) {
         assert(st);
 
index a566114f7c9bd5a734881804930da8ca70822720..f7d2f12aa9dcb7642b5b9b1e8ce45263cd8d131e 100644 (file)
@@ -53,6 +53,7 @@ int fd_is_temporary_fs(int fd);
 int fd_is_network_fs(int fd);
 
 int path_is_temporary_fs(const char *path);
+int path_is_network_fs(const char *path);
 
 /* Because statfs.t_type can be int on some architectures, we have to cast
  * the const magic to the type, otherwise the compiler warns about