diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-03-02 10:41:29 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2024-03-04 20:53:51 +0100 |
commit | 2560dcbfe6bd555de79a90758a8246de123dc3f5 (patch) | |
tree | 45ff5a22f661cddcbda95f590592281501333f70 /src/basic/stat-util.h | |
parent | resolved,pcrlock: make a bunch of varlink introspection structures static (diff) | |
download | systemd-2560dcbfe6bd555de79a90758a8246de123dc3f5.tar.xz systemd-2560dcbfe6bd555de79a90758a8246de123dc3f5.zip |
stat-util: generalize is_* and verify_* handling
Diffstat (limited to 'src/basic/stat-util.h')
-rw-r--r-- | src/basic/stat-util.h | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index bab5415357..47445d852a 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -14,14 +14,22 @@ #include "siphash24.h" #include "time-util.h" +int stat_verify_regular(const struct stat *st); +int verify_regular_at(int fd, const char *path, bool follow); +int fd_verify_regular(int fd); + +int stat_verify_directory(const struct stat *st); +int fd_verify_directory(int fd); +int is_dir_at(int fd, const char *path, bool follow); +int is_dir(const char *path, bool follow); + +int stat_verify_symlink(const struct stat *st); int is_symlink(const char *path); -int is_dir_full(int atfd, const char *fname, bool follow); -static inline int is_dir(const char *path, bool follow) { - return is_dir_full(AT_FDCWD, path, follow); -} -static inline int is_dir_fd(int fd) { - return is_dir_full(fd, NULL, false); -} + +int stat_verify_linked(const struct stat *st); +int fd_verify_linked(int fd); + +int stat_verify_device_node(const struct stat *st); int is_device_node(const char *path); int dir_is_empty_at(int dir_fd, const char *path, bool ignore_hidden_or_backup); @@ -72,16 +80,6 @@ int path_is_network_fs(const char *path); */ #define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b) -int stat_verify_linked(const struct stat *st); -int fd_verify_linked(int fd); - -int stat_verify_regular(const struct stat *st); -int fd_verify_regular(int fd); -int verify_regular_at(int dir_fd, const char *path, bool follow); - -int stat_verify_directory(const struct stat *st); -int fd_verify_directory(int fd); - int proc_mounted(void); bool stat_inode_same(const struct stat *a, const struct stat *b); |