diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-26 20:07:55 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-27 13:25:56 +0100 |
commit | a09561746f15b84da9471b5c4be74e53d19e4f3f (patch) | |
tree | e99301f014ab8d150891d936ca061e369f7bae33 /src/basic/util.h | |
parent | 78f22b973fa2c9b09bd974680836df17163d9ee0 (diff) |
util-lib: introduce dirent-util.[ch] for directory entry calls
Also, move a couple of more path-related functions to path-util.c.
Diffstat (limited to 'src/basic/util.h')
-rw-r--r-- | src/basic/util.h | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/basic/util.h b/src/basic/util.h index 6e5df01450..190d4f5edb 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -22,7 +22,6 @@ ***/ #include <alloca.h> -#include <dirent.h> #include <fcntl.h> #include <inttypes.h> #include <limits.h> @@ -90,15 +89,8 @@ int readlink_value(const char *p, char **ret); int readlink_and_make_absolute(const char *p, char **r); int readlink_and_canonicalize(const char *p, char **r); -char *file_in_same_dir(const char *path, const char *filename); - int rmdir_parents(const char *path, const char *stop); -bool dirent_is_file(const struct dirent *de) _pure_; -bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_; - -bool hidden_file(const char *filename) _pure_; - /* For basic lookup tables with strictly enumerated entries */ #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ scope const char *name##_to_string(type i) { \ @@ -157,8 +149,6 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k bool fstype_is_network(const char *fstype); -bool is_device_path(const char *path); - int dir_is_empty(const char *path); static inline int dir_is_populated(const char *path) { @@ -216,8 +206,6 @@ int socket_from_display(const char *display, char **path); int glob_exists(const char *path); int glob_extend(char ***strv, const char *path); -int dirent_ensure_type(DIR *d, struct dirent *de); - int get_files_in_directory(const char *path, char ***list); bool is_main_thread(void); @@ -332,26 +320,6 @@ const char *draw_special_char(DrawSpecialChar ch); int on_ac_power(void); -#define FOREACH_DIRENT(de, d, on_error) \ - for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \ - if (!de) { \ - if (errno > 0) { \ - on_error; \ - } \ - break; \ - } else if (hidden_file((de)->d_name)) \ - continue; \ - else - -#define FOREACH_DIRENT_ALL(de, d, on_error) \ - for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \ - if (!de) { \ - if (errno > 0) { \ - on_error; \ - } \ - break; \ - } else - static inline void *mempset(void *s, int c, size_t n) { memset(s, c, n); return (uint8_t*)s + n; |