fs-util: Reduce transitive includes

This commit is contained in:
Daan De Meyer
2025-05-07 22:04:46 +09:00
committed by Yu Watanabe
parent c034915cb6
commit fda652117e
45 changed files with 68 additions and 19 deletions
+4 -19
View File
@@ -10,11 +10,9 @@
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "lock-util.h"
#include "memory-util.h"
#include "time-util.h"
#include "user-util.h"
#define MODE_INVALID ((mode_t) -1)
@@ -51,16 +49,11 @@ int futimens_opath(int fd, const struct timespec ts[2]);
int fd_warn_permissions(const char *path, int fd);
int stat_warn_permissions(const char *path, const struct stat *st);
#define access_nofollow(path, mode) \
RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW))
int access_nofollow(const char *path, mode_t mode);
int touch_fd(int fd, usec_t stamp);
int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
static inline int touch(const char *path) {
return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
}
int touch(const char *path);
int symlinkat_idempotent(const char *from, int atfd, const char *to, bool make_relative);
static inline int symlink_idempotent(const char *from, const char *to, bool make_relative) {
@@ -90,15 +83,7 @@ int var_tmp_dir(const char **ret);
int unlink_or_warn(const char *filename);
/* Useful for usage with _cleanup_(), removes a directory and frees the pointer */
static inline char *rmdir_and_free(char *p) {
PROTECT_ERRNO;
if (!p)
return NULL;
(void) rmdir(p);
return mfree(p);
}
char *rmdir_and_free(char *p);
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, rmdir_and_free);
static inline char* unlink_and_free(char *p) {