From: Yu Watanabe Date: Fri, 4 Feb 2022 06:22:20 +0000 (+0900) Subject: stat-util: introduce path_is_network_fs() X-Git-Tag: v251-rc1~341^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e247216e58ff26f10a2af13d290465f0a65a501;p=thirdparty%2Fsystemd.git stat-util: introduce path_is_network_fs() --- diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index efac7b002e4..c2269844f81 100644 --- a/src/basic/stat-util.c +++ b/src/basic/stat-util.c @@ -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); diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index a566114f7c9..f7d2f12aa9d 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -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