]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util-lib: move a number of fs operations into fs-util.[ch]
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Oct 2015 20:16:26 +0000 (21:16 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 27 Oct 2015 12:25:56 +0000 (13:25 +0100)
64 files changed:
Makefile.am
src/basic/cgroup-util.c
src/basic/copy.c
src/basic/fileio.c
src/basic/fs-util.c [new file with mode: 0644]
src/basic/fs-util.h [new file with mode: 0644]
src/basic/lockfile-util.c
src/basic/mkdir.c
src/basic/path-util.c
src/basic/process-util.c
src/basic/terminal-util.c
src/basic/time-util.c
src/basic/util.c
src/basic/util.h
src/core/execute.c
src/core/load-fragment.c
src/core/machine-id-setup.c
src/core/main.c
src/core/manager.c
src/core/service.c
src/core/timer.c
src/delta/delta.c
src/firstboot/firstboot.c
src/fsck/fsck.c
src/hwdb/hwdb.c
src/import/export.c
src/import/import-raw.c
src/import/import-tar.c
src/import/import.c
src/import/pull-dkr.c
src/import/pull-raw.c
src/import/pull-tar.c
src/journal/coredump.c
src/journal/journalctl.c
src/journal/journald-native.c
src/journal/journald-server.c
src/libsystemd/sd-daemon/sd-daemon.c
src/libsystemd/sd-device/device-private.c
src/libsystemd/sd-device/sd-device.c
src/libsystemd/sd-login/sd-login.c
src/login/logind-dbus.c
src/login/logind-user.c
src/machine/machine-dbus.c
src/nspawn/nspawn-mount.c
src/nspawn/nspawn.c
src/shared/conf-parser.c
src/shared/install.c
src/shared/machine-image.c
src/shared/machine-pool.c
src/system-update-generator/system-update-generator.c
src/systemctl/systemctl.c
src/test/test-conf-files.c
src/test/test-copy.c
src/test/test-execute.c
src/test/test-path.c
src/test/test-udev.c
src/test/test-util.c
src/timedate/timedated.c
src/timesync/timesyncd-manager.c
src/timesync/timesyncd.c
src/tmpfiles/tmpfiles.c
src/udev/udev-node.c
src/udev/udevadm-hwdb.c
src/udev/udevd.c

index 15aace196a8b61e5149afc92b9c95008f410fc20..810ced3326e6d477487dfb475d3ea4afdd44bd69 100644 (file)
@@ -799,6 +799,8 @@ libbasic_la_SOURCES = \
        src/basic/xattr-util.h \
        src/basic/chattr-util.c \
        src/basic/chattr-util.h \
+       src/basic/fs-util.c \
+       src/basic/fs-util.h \
        src/basic/mount-util.c \
        src/basic/mount-util.h \
        src/basic/hexdecoct.c \
index 67dc29119217ff9156eef6a5360cfeb9bc6797f5..84aea8afb8c4c742e90e93de9650a7e522ff0d75 100644 (file)
@@ -35,6 +35,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "login-util.h"
 #include "macro.h"
 #include "mkdir.h"
index 89100521164844c5c83b2885a5dae5bb2d48337d..f1413f74b0e26ddb6a3c515579c08a91949e9291 100644 (file)
@@ -28,6 +28,7 @@
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "io-util.h"
 #include "string-util.h"
 #include "strv.h"
index b7e447f6b612db250b6f0ef88bc6b8fdda67d9c3..2c4d70aa1c4179f19a16573ad7dcba81646a2b26 100644 (file)
@@ -25,6 +25,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hexdecoct.h"
 #include "path-util.h"
 #include "random-util.h"
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
new file mode 100644 (file)
index 0000000..bd775b7
--- /dev/null
@@ -0,0 +1,477 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "dirent-util.h"
+#include "fd-util.h"
+#include "fileio.h"
+#include "fs-util.h"
+#include "mkdir.h"
+#include "path-util.h"
+#include "string-util.h"
+#include "strv.h"
+#include "util.h"
+
+int unlink_noerrno(const char *path) {
+        PROTECT_ERRNO;
+        int r;
+
+        r = unlink(path);
+        if (r < 0)
+                return -errno;
+
+        return 0;
+}
+
+int rmdir_parents(const char *path, const char *stop) {
+        size_t l;
+        int r = 0;
+
+        assert(path);
+        assert(stop);
+
+        l = strlen(path);
+
+        /* Skip trailing slashes */
+        while (l > 0 && path[l-1] == '/')
+                l--;
+
+        while (l > 0) {
+                char *t;
+
+                /* Skip last component */
+                while (l > 0 && path[l-1] != '/')
+                        l--;
+
+                /* Skip trailing slashes */
+                while (l > 0 && path[l-1] == '/')
+                        l--;
+
+                if (l <= 0)
+                        break;
+
+                t = strndup(path, l);
+                if (!t)
+                        return -ENOMEM;
+
+                if (path_startswith(stop, t)) {
+                        free(t);
+                        return 0;
+                }
+
+                r = rmdir(t);
+                free(t);
+
+                if (r < 0)
+                        if (errno != ENOENT)
+                                return -errno;
+        }
+
+        return 0;
+}
+
+
+int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) {
+        struct stat buf;
+        int ret;
+
+        ret = renameat2(olddirfd, oldpath, newdirfd, newpath, RENAME_NOREPLACE);
+        if (ret >= 0)
+                return 0;
+
+        /* renameat2() exists since Linux 3.15, btrfs added support for it later.
+         * If it is not implemented, fallback to another method. */
+        if (!IN_SET(errno, EINVAL, ENOSYS))
+                return -errno;
+
+        /* The link()/unlink() fallback does not work on directories. But
+         * renameat() without RENAME_NOREPLACE gives the same semantics on
+         * directories, except when newpath is an *empty* directory. This is
+         * good enough. */
+        ret = fstatat(olddirfd, oldpath, &buf, AT_SYMLINK_NOFOLLOW);
+        if (ret >= 0 && S_ISDIR(buf.st_mode)) {
+                ret = renameat(olddirfd, oldpath, newdirfd, newpath);
+                return ret >= 0 ? 0 : -errno;
+        }
+
+        /* If it is not a directory, use the link()/unlink() fallback. */
+        ret = linkat(olddirfd, oldpath, newdirfd, newpath, 0);
+        if (ret < 0)
+                return -errno;
+
+        ret = unlinkat(olddirfd, oldpath, 0);
+        if (ret < 0) {
+                /* backup errno before the following unlinkat() alters it */
+                ret = errno;
+                (void) unlinkat(newdirfd, newpath, 0);
+                errno = ret;
+                return -errno;
+        }
+
+        return 0;
+}
+
+int readlinkat_malloc(int fd, const char *p, char **ret) {
+        size_t l = 100;
+        int r;
+
+        assert(p);
+        assert(ret);
+
+        for (;;) {
+                char *c;
+                ssize_t n;
+
+                c = new(char, l);
+                if (!c)
+                        return -ENOMEM;
+
+                n = readlinkat(fd, p, c, l-1);
+                if (n < 0) {
+                        r = -errno;
+                        free(c);
+                        return r;
+                }
+
+                if ((size_t) n < l-1) {
+                        c[n] = 0;
+                        *ret = c;
+                        return 0;
+                }
+
+                free(c);
+                l *= 2;
+        }
+}
+
+int readlink_malloc(const char *p, char **ret) {
+        return readlinkat_malloc(AT_FDCWD, p, ret);
+}
+
+int readlink_value(const char *p, char **ret) {
+        _cleanup_free_ char *link = NULL;
+        char *value;
+        int r;
+
+        r = readlink_malloc(p, &link);
+        if (r < 0)
+                return r;
+
+        value = basename(link);
+        if (!value)
+                return -ENOENT;
+
+        value = strdup(value);
+        if (!value)
+                return -ENOMEM;
+
+        *ret = value;
+
+        return 0;
+}
+
+int readlink_and_make_absolute(const char *p, char **r) {
+        _cleanup_free_ char *target = NULL;
+        char *k;
+        int j;
+
+        assert(p);
+        assert(r);
+
+        j = readlink_malloc(p, &target);
+        if (j < 0)
+                return j;
+
+        k = file_in_same_dir(p, target);
+        if (!k)
+                return -ENOMEM;
+
+        *r = k;
+        return 0;
+}
+
+int readlink_and_canonicalize(const char *p, char **r) {
+        char *t, *s;
+        int j;
+
+        assert(p);
+        assert(r);
+
+        j = readlink_and_make_absolute(p, &t);
+        if (j < 0)
+                return j;
+
+        s = canonicalize_file_name(t);
+        if (s) {
+                free(t);
+                *r = s;
+        } else
+                *r = t;
+
+        path_kill_slashes(*r);
+
+        return 0;
+}
+
+int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) {
+        assert(path);
+
+        /* Under the assumption that we are running privileged we
+         * first change the access mode and only then hand out
+         * ownership to avoid a window where access is too open. */
+
+        if (mode != MODE_INVALID)
+                if (chmod(path, mode) < 0)
+                        return -errno;
+
+        if (uid != UID_INVALID || gid != GID_INVALID)
+                if (chown(path, uid, gid) < 0)
+                        return -errno;
+
+        return 0;
+}
+
+int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
+        assert(fd >= 0);
+
+        /* Under the assumption that we are running privileged we
+         * first change the access mode and only then hand out
+         * ownership to avoid a window where access is too open. */
+
+        if (mode != MODE_INVALID)
+                if (fchmod(fd, mode) < 0)
+                        return -errno;
+
+        if (uid != UID_INVALID || gid != GID_INVALID)
+                if (fchown(fd, uid, gid) < 0)
+                        return -errno;
+
+        return 0;
+}
+
+int fchmod_umask(int fd, mode_t m) {
+        mode_t u;
+        int r;
+
+        u = umask(0777);
+        r = fchmod(fd, m & (~u)) < 0 ? -errno : 0;
+        umask(u);
+
+        return r;
+}
+
+int fd_warn_permissions(const char *path, int fd) {
+        struct stat st;
+
+        if (fstat(fd, &st) < 0)
+                return -errno;
+
+        if (st.st_mode & 0111)
+                log_warning("Configuration file %s is marked executable. Please remove executable permission bits. Proceeding anyway.", path);
+
+        if (st.st_mode & 0002)
+                log_warning("Configuration file %s is marked world-writable. Please remove world writability permission bits. Proceeding anyway.", path);
+
+        if (getpid() == 1 && (st.st_mode & 0044) != 0044)
+                log_warning("Configuration file %s is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.", path);
+
+        return 0;
+}
+
+int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode) {
+        _cleanup_close_ int fd;
+        int r;
+
+        assert(path);
+
+        if (parents)
+                mkdir_parents(path, 0755);
+
+        fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, mode > 0 ? mode : 0644);
+        if (fd < 0)
+                return -errno;
+
+        if (mode > 0) {
+                r = fchmod(fd, mode);
+                if (r < 0)
+                        return -errno;
+        }
+
+        if (uid != UID_INVALID || gid != GID_INVALID) {
+                r = fchown(fd, uid, gid);
+                if (r < 0)
+                        return -errno;
+        }
+
+        if (stamp != USEC_INFINITY) {
+                struct timespec ts[2];
+
+                timespec_store(&ts[0], stamp);
+                ts[1] = ts[0];
+                r = futimens(fd, ts);
+        } else
+                r = futimens(fd, NULL);
+        if (r < 0)
+                return -errno;
+
+        return 0;
+}
+
+int touch(const char *path) {
+        return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, 0);
+}
+
+int symlink_idempotent(const char *from, const char *to) {
+        _cleanup_free_ char *p = NULL;
+        int r;
+
+        assert(from);
+        assert(to);
+
+        if (symlink(from, to) < 0) {
+                if (errno != EEXIST)
+                        return -errno;
+
+                r = readlink_malloc(to, &p);
+                if (r < 0)
+                        return r;
+
+                if (!streq(p, from))
+                        return -EINVAL;
+        }
+
+        return 0;
+}
+
+int symlink_atomic(const char *from, const char *to) {
+        _cleanup_free_ char *t = NULL;
+        int r;
+
+        assert(from);
+        assert(to);
+
+        r = tempfn_random(to, NULL, &t);
+        if (r < 0)
+                return r;
+
+        if (symlink(from, t) < 0)
+                return -errno;
+
+        if (rename(t, to) < 0) {
+                unlink_noerrno(t);
+                return -errno;
+        }
+
+        return 0;
+}
+
+int mknod_atomic(const char *path, mode_t mode, dev_t dev) {
+        _cleanup_free_ char *t = NULL;
+        int r;
+
+        assert(path);
+
+        r = tempfn_random(path, NULL, &t);
+        if (r < 0)
+                return r;
+
+        if (mknod(t, mode, dev) < 0)
+                return -errno;
+
+        if (rename(t, path) < 0) {
+                unlink_noerrno(t);
+                return -errno;
+        }
+
+        return 0;
+}
+
+int mkfifo_atomic(const char *path, mode_t mode) {
+        _cleanup_free_ char *t = NULL;
+        int r;
+
+        assert(path);
+
+        r = tempfn_random(path, NULL, &t);
+        if (r < 0)
+                return r;
+
+        if (mkfifo(t, mode) < 0)
+                return -errno;
+
+        if (rename(t, path) < 0) {
+                unlink_noerrno(t);
+                return -errno;
+        }
+
+        return 0;
+}
+
+int get_files_in_directory(const char *path, char ***list) {
+        _cleanup_closedir_ DIR *d = NULL;
+        size_t bufsize = 0, n = 0;
+        _cleanup_strv_free_ char **l = NULL;
+
+        assert(path);
+
+        /* Returns all files in a directory in *list, and the number
+         * of files as return value. If list is NULL returns only the
+         * number. */
+
+        d = opendir(path);
+        if (!d)
+                return -errno;
+
+        for (;;) {
+                struct dirent *de;
+
+                errno = 0;
+                de = readdir(d);
+                if (!de && errno != 0)
+                        return -errno;
+                if (!de)
+                        break;
+
+                dirent_ensure_type(d, de);
+
+                if (!dirent_is_file(de))
+                        continue;
+
+                if (list) {
+                        /* one extra slot is needed for the terminating NULL */
+                        if (!GREEDY_REALLOC(l, bufsize, n + 2))
+                                return -ENOMEM;
+
+                        l[n] = strdup(de->d_name);
+                        if (!l[n])
+                                return -ENOMEM;
+
+                        l[++n] = NULL;
+                } else
+                        n++;
+        }
+
+        if (list) {
+                *list = l;
+                l = NULL; /* avoid freeing */
+        }
+
+        return n;
+}
diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
new file mode 100644 (file)
index 0000000..0e1906b
--- /dev/null
@@ -0,0 +1,60 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "time-util.h"
+
+int unlink_noerrno(const char *path);
+
+int rmdir_parents(const char *path, const char *stop);
+
+int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+
+int readlinkat_malloc(int fd, const char *p, char **ret);
+int readlink_malloc(const char *p, char **r);
+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);
+
+int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
+int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);
+
+int fchmod_umask(int fd, mode_t mode);
+
+int fd_warn_permissions(const char *path, int fd);
+
+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)
+
+int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
+int touch(const char *path);
+
+int symlink_idempotent(const char *from, const char *to);
+
+int symlink_atomic(const char *from, const char *to);
+int mknod_atomic(const char *path, mode_t mode, dev_t dev);
+int mkfifo_atomic(const char *path, mode_t mode);
+
+int get_files_in_directory(const char *path, char ***list);
index 6eee3009d8784dd5716a4e7890050781eb8ed102..60235cc9723952850e16502c2c491f24deaebcd1 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "lockfile-util.h"
 #include "path-util.h"
 #include "util.h"
index 7ee4546988b353aef2f1fb4f95dcda635e49bdf1..4fe90b2bb70a0a59ecf219ec89b47be35287c6b2 100644 (file)
 #include <string.h>
 #include <errno.h>
 
-#include "util.h"
-#include "path-util.h"
+#include "fs-util.h"
 #include "mkdir.h"
+#include "path-util.h"
+#include "util.h"
 
 int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkdir_func_t _mkdir) {
         struct stat st;
index ed30c3d92dd5a86532bcf19925fb4302fd2efda4..256a98f3e6e1514f59da5ad653417e0405111924 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "log.h"
 #include "macro.h"
 #include "missing.h"
index 72fc82e7cb78f7ec18313ce141c9b21ebc0f8014..e0061d15b3def9cbc52769fc70ba4d0c662f1ecb 100644 (file)
@@ -31,6 +31,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "log.h"
 #include "process-util.h"
 #include "signal-util.h"
index 2fe5c26a6722a10a25ed2a22303a04f1ad9b7cd6..1edceacfa2a9114608be65597626c47d48892df6 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "io-util.h"
 #include "parse-util.h"
 #include "path-util.h"
index b7d92cbad884d9907315287a0094d44711cecf8d..867e7b2430a72da0ed2698a8cd5b1976d0ce1fb7 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "path-util.h"
 #include "string-util.h"
 #include "strv.h"
index 889ca288fced1335e00247e92422b1d9cbf8a7ca..92ce009620f681cfdfa32137bd558798466c10fd 100644 (file)
@@ -123,176 +123,6 @@ size_t page_size(void) {
         return pgsz;
 }
 
-int unlink_noerrno(const char *path) {
-        PROTECT_ERRNO;
-        int r;
-
-        r = unlink(path);
-        if (r < 0)
-                return -errno;
-
-        return 0;
-}
-
-int fchmod_umask(int fd, mode_t m) {
-        mode_t u;
-        int r;
-
-        u = umask(0777);
-        r = fchmod(fd, m & (~u)) < 0 ? -errno : 0;
-        umask(u);
-
-        return r;
-}
-
-int readlinkat_malloc(int fd, const char *p, char **ret) {
-        size_t l = 100;
-        int r;
-
-        assert(p);
-        assert(ret);
-
-        for (;;) {
-                char *c;
-                ssize_t n;
-
-                c = new(char, l);
-                if (!c)
-                        return -ENOMEM;
-
-                n = readlinkat(fd, p, c, l-1);
-                if (n < 0) {
-                        r = -errno;
-                        free(c);
-                        return r;
-                }
-
-                if ((size_t) n < l-1) {
-                        c[n] = 0;
-                        *ret = c;
-                        return 0;
-                }
-
-                free(c);
-                l *= 2;
-        }
-}
-
-int readlink_malloc(const char *p, char **ret) {
-        return readlinkat_malloc(AT_FDCWD, p, ret);
-}
-
-int readlink_value(const char *p, char **ret) {
-        _cleanup_free_ char *link = NULL;
-        char *value;
-        int r;
-
-        r = readlink_malloc(p, &link);
-        if (r < 0)
-                return r;
-
-        value = basename(link);
-        if (!value)
-                return -ENOENT;
-
-        value = strdup(value);
-        if (!value)
-                return -ENOMEM;
-
-        *ret = value;
-
-        return 0;
-}
-
-int readlink_and_make_absolute(const char *p, char **r) {
-        _cleanup_free_ char *target = NULL;
-        char *k;
-        int j;
-
-        assert(p);
-        assert(r);
-
-        j = readlink_malloc(p, &target);
-        if (j < 0)
-                return j;
-
-        k = file_in_same_dir(p, target);
-        if (!k)
-                return -ENOMEM;
-
-        *r = k;
-        return 0;
-}
-
-int readlink_and_canonicalize(const char *p, char **r) {
-        char *t, *s;
-        int j;
-
-        assert(p);
-        assert(r);
-
-        j = readlink_and_make_absolute(p, &t);
-        if (j < 0)
-                return j;
-
-        s = canonicalize_file_name(t);
-        if (s) {
-                free(t);
-                *r = s;
-        } else
-                *r = t;
-
-        path_kill_slashes(*r);
-
-        return 0;
-}
-
-int rmdir_parents(const char *path, const char *stop) {
-        size_t l;
-        int r = 0;
-
-        assert(path);
-        assert(stop);
-
-        l = strlen(path);
-
-        /* Skip trailing slashes */
-        while (l > 0 && path[l-1] == '/')
-                l--;
-
-        while (l > 0) {
-                char *t;
-
-                /* Skip last component */
-                while (l > 0 && path[l-1] != '/')
-                        l--;
-
-                /* Skip trailing slashes */
-                while (l > 0 && path[l-1] == '/')
-                        l--;
-
-                if (l <= 0)
-                        break;
-
-                if (!(t = strndup(path, l)))
-                        return -ENOMEM;
-
-                if (path_startswith(stop, t)) {
-                        free(t);
-                        return 0;
-                }
-
-                r = rmdir(t);
-                free(t);
-
-                if (r < 0)
-                        if (errno != ENOENT)
-                                return -errno;
-        }
-
-        return 0;
-}
-
 bool fstype_is_network(const char *fstype) {
         static const char table[] =
                 "afs\0"
@@ -401,42 +231,6 @@ int fd_is_temporary_fs(int fd) {
         return is_temporary_fs(&s);
 }
 
-int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) {
-        assert(path);
-
-        /* Under the assumption that we are running privileged we
-         * first change the access mode and only then hand out
-         * ownership to avoid a window where access is too open. */
-
-        if (mode != MODE_INVALID)
-                if (chmod(path, mode) < 0)
-                        return -errno;
-
-        if (uid != UID_INVALID || gid != GID_INVALID)
-                if (chown(path, uid, gid) < 0)
-                        return -errno;
-
-        return 0;
-}
-
-int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
-        assert(fd >= 0);
-
-        /* Under the assumption that we are running privileged we
-         * first change the access mode and only then hand out
-         * ownership to avoid a window where access is too open. */
-
-        if (mode != MODE_INVALID)
-                if (fchmod(fd, mode) < 0)
-                        return -errno;
-
-        if (uid != UID_INVALID || gid != GID_INVALID)
-                if (fchown(fd, uid, gid) < 0)
-                        return -errno;
-
-        return 0;
-}
-
 int files_same(const char *filea, const char *fileb) {
         struct stat a, b;
 
@@ -460,49 +254,6 @@ int running_in_chroot(void) {
         return ret == 0;
 }
 
-int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode) {
-        _cleanup_close_ int fd;
-        int r;
-
-        assert(path);
-
-        if (parents)
-                mkdir_parents(path, 0755);
-
-        fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, mode > 0 ? mode : 0644);
-        if (fd < 0)
-                return -errno;
-
-        if (mode > 0) {
-                r = fchmod(fd, mode);
-                if (r < 0)
-                        return -errno;
-        }
-
-        if (uid != UID_INVALID || gid != GID_INVALID) {
-                r = fchown(fd, uid, gid);
-                if (r < 0)
-                        return -errno;
-        }
-
-        if (stamp != USEC_INFINITY) {
-                struct timespec ts[2];
-
-                timespec_store(&ts[0], stamp);
-                ts[1] = ts[0];
-                r = futimens(fd, ts);
-        } else
-                r = futimens(fd, NULL);
-        if (r < 0)
-                return -errno;
-
-        return 0;
-}
-
-int touch(const char *path) {
-        return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, 0);
-}
-
 noreturn void freeze(void) {
 
         /* Make sure nobody waits for us on a socket anymore */
@@ -692,92 +443,6 @@ bool plymouth_running(void) {
         return access("/run/plymouth/pid", F_OK) >= 0;
 }
 
-int symlink_atomic(const char *from, const char *to) {
-        _cleanup_free_ char *t = NULL;
-        int r;
-
-        assert(from);
-        assert(to);
-
-        r = tempfn_random(to, NULL, &t);
-        if (r < 0)
-                return r;
-
-        if (symlink(from, t) < 0)
-                return -errno;
-
-        if (rename(t, to) < 0) {
-                unlink_noerrno(t);
-                return -errno;
-        }
-
-        return 0;
-}
-
-int symlink_idempotent(const char *from, const char *to) {
-        _cleanup_free_ char *p = NULL;
-        int r;
-
-        assert(from);
-        assert(to);
-
-        if (symlink(from, to) < 0) {
-                if (errno != EEXIST)
-                        return -errno;
-
-                r = readlink_malloc(to, &p);
-                if (r < 0)
-                        return r;
-
-                if (!streq(p, from))
-                        return -EINVAL;
-        }
-
-        return 0;
-}
-
-int mknod_atomic(const char *path, mode_t mode, dev_t dev) {
-        _cleanup_free_ char *t = NULL;
-        int r;
-
-        assert(path);
-
-        r = tempfn_random(path, NULL, &t);
-        if (r < 0)
-                return r;
-
-        if (mknod(t, mode, dev) < 0)
-                return -errno;
-
-        if (rename(t, path) < 0) {
-                unlink_noerrno(t);
-                return -errno;
-        }
-
-        return 0;
-}
-
-int mkfifo_atomic(const char *path, mode_t mode) {
-        _cleanup_free_ char *t = NULL;
-        int r;
-
-        assert(path);
-
-        r = tempfn_random(path, NULL, &t);
-        if (r < 0)
-                return r;
-
-        if (mkfifo(t, mode) < 0)
-                return -errno;
-
-        if (rename(t, path) < 0) {
-                unlink_noerrno(t);
-                return -errno;
-        }
-
-        return 0;
-}
-
 bool display_is_local(const char *display) {
         assert(display);
 
@@ -855,58 +520,6 @@ int glob_extend(char ***strv, const char *path) {
         return k;
 }
 
-int get_files_in_directory(const char *path, char ***list) {
-        _cleanup_closedir_ DIR *d = NULL;
-        size_t bufsize = 0, n = 0;
-        _cleanup_strv_free_ char **l = NULL;
-
-        assert(path);
-
-        /* Returns all files in a directory in *list, and the number
-         * of files as return value. If list is NULL returns only the
-         * number. */
-
-        d = opendir(path);
-        if (!d)
-                return -errno;
-
-        for (;;) {
-                struct dirent *de;
-
-                errno = 0;
-                de = readdir(d);
-                if (!de && errno != 0)
-                        return -errno;
-                if (!de)
-                        break;
-
-                dirent_ensure_type(d, de);
-
-                if (!dirent_is_file(de))
-                        continue;
-
-                if (list) {
-                        /* one extra slot is needed for the terminating NULL */
-                        if (!GREEDY_REALLOC(l, bufsize, n + 2))
-                                return -ENOMEM;
-
-                        l[n] = strdup(de->d_name);
-                        if (!l[n])
-                                return -ENOMEM;
-
-                        l[++n] = NULL;
-                } else
-                        n++;
-        }
-
-        if (list) {
-                *list = l;
-                l = NULL; /* avoid freeing */
-        }
-
-        return n;
-}
-
 bool is_main_thread(void) {
         static thread_local int cached = 0;
 
@@ -1815,24 +1428,6 @@ int namespace_enter(int pidns_fd, int mntns_fd, int netns_fd, int userns_fd, int
         return reset_uid_gid();
 }
 
-int fd_warn_permissions(const char *path, int fd) {
-        struct stat st;
-
-        if (fstat(fd, &st) < 0)
-                return -errno;
-
-        if (st.st_mode & 0111)
-                log_warning("Configuration file %s is marked executable. Please remove executable permission bits. Proceeding anyway.", path);
-
-        if (st.st_mode & 0002)
-                log_warning("Configuration file %s is marked world-writable. Please remove world writability permission bits. Proceeding anyway.", path);
-
-        if (getpid() == 1 && (st.st_mode & 0044) != 0044)
-                log_warning("Configuration file %s is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.", path);
-
-        return 0;
-}
-
 unsigned long personality_from_string(const char *p) {
 
         /* Parse a personality specifier. We introduce our own
@@ -2017,46 +1612,6 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
         return -1;
 }
 
-int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) {
-        struct stat buf;
-        int ret;
-
-        ret = renameat2(olddirfd, oldpath, newdirfd, newpath, RENAME_NOREPLACE);
-        if (ret >= 0)
-                return 0;
-
-        /* renameat2() exists since Linux 3.15, btrfs added support for it later.
-         * If it is not implemented, fallback to another method. */
-        if (!IN_SET(errno, EINVAL, ENOSYS))
-                return -errno;
-
-        /* The link()/unlink() fallback does not work on directories. But
-         * renameat() without RENAME_NOREPLACE gives the same semantics on
-         * directories, except when newpath is an *empty* directory. This is
-         * good enough. */
-        ret = fstatat(olddirfd, oldpath, &buf, AT_SYMLINK_NOFOLLOW);
-        if (ret >= 0 && S_ISDIR(buf.st_mode)) {
-                ret = renameat(olddirfd, oldpath, newdirfd, newpath);
-                return ret >= 0 ? 0 : -errno;
-        }
-
-        /* If it is not a directory, use the link()/unlink() fallback. */
-        ret = linkat(olddirfd, oldpath, newdirfd, newpath, 0);
-        if (ret < 0)
-                return -errno;
-
-        ret = unlinkat(olddirfd, oldpath, 0);
-        if (ret < 0) {
-                /* backup errno before the following unlinkat() alters it */
-                ret = errno;
-                (void) unlinkat(newdirfd, newpath, 0);
-                errno = ret;
-                return -errno;
-        }
-
-        return 0;
-}
-
 int version(void) {
         puts(PACKAGE_STRING "\n"
              SYSTEMD_FEATURES);
index 30c88d38ad743e04d2a5fb33f280690de95d6fa9..7608e49689e317f5bacdff4222b6d731acd878b6 100644 (file)
@@ -83,14 +83,6 @@ static inline const char* one_zero(bool b) {
         return b ? "1" : "0";
 }
 
-int readlinkat_malloc(int fd, const char *p, char **ret);
-int readlink_malloc(const char *p, char **r);
-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);
-
-int rmdir_parents(const char *path, const char *stop);
-
 /* 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) {                    \
@@ -159,9 +151,6 @@ static inline int dir_is_populated(const char *path) {
         return !r;
 }
 
-int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
-int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);
-
 typedef long statfs_f_type_t;
 
 bool is_fs_type(const struct statfs *s, statfs_f_type_t magic_value) _pure_;
@@ -179,9 +168,6 @@ int files_same(const char *filea, const char *fileb);
 
 int running_in_chroot(void);
 
-int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
-int touch(const char *path);
-
 noreturn void freeze(void);
 
 bool null_or_empty(struct stat *st) _pure_;
@@ -192,22 +178,12 @@ void execute_directories(const char* const* directories, usec_t timeout, char *a
 
 bool plymouth_running(void);
 
-int symlink_idempotent(const char *from, const char *to);
-
-int symlink_atomic(const char *from, const char *to);
-int mknod_atomic(const char *path, mode_t mode, dev_t dev);
-int mkfifo_atomic(const char *path, mode_t mode);
-
-int fchmod_umask(int fd, mode_t mode);
-
 bool display_is_local(const char *display) _pure_;
 int socket_from_display(const char *display, char **path);
 
 int glob_exists(const char *path);
 int glob_extend(char ***strv, const char *path);
 
-int get_files_in_directory(const char *path, char ***list);
-
 bool is_main_thread(void);
 
 int block_get_whole_disk(dev_t d, dev_t *ret);
@@ -408,8 +384,6 @@ static inline unsigned log2u_round_up(unsigned x) {
                 ans;                                    \
         })
 
-int unlink_noerrno(const char *path);
-
 #define alloca0(n)                                      \
         ({                                              \
                 char *_new_;                            \
@@ -460,8 +434,6 @@ int container_get_leader(const char *machine, pid_t *pid);
 int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *userns_fd, int *root_fd);
 int namespace_enter(int pidns_fd, int mntns_fd, int netns_fd, int userns_fd, int root_fd);
 
-int fd_warn_permissions(const char *path, int fd);
-
 #ifndef PERSONALITY_INVALID
 /* personality(7) documents that 0xffffffffUL is used for querying the
  * current personality, hence let's use that here as error
@@ -498,12 +470,8 @@ union inotify_event_buffer {
         uint8_t raw[INOTIFY_EVENT_MAX];
 };
 
-#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)
-
 int syslog_parse_priority(const char **p, int *priority, bool with_facility);
 
-int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
-
 int version(void);
 
 bool fdname_is_valid(const char *s);
index ad0e6be4b7db529fd63f865680376255cfe62fb4..a9564386ba35364694b8317f05cdbad27ffbb0e9 100644 (file)
@@ -69,6 +69,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "io-util.h"
 #include "ioprio.h"
 #include "log.h"
index f5c28e514f879c053b1a6bb4202be2968c769c17..688c4c7e0cae53c15cc254e5028b74d5d777c77a 100644 (file)
@@ -44,6 +44,7 @@
 #include "errno-list.h"
 #include "escape.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "ioprio.h"
 #include "load-fragment.h"
 #include "log.h"
index 764728c804c6398c3180701d87e5c5da7d4a7c22..921f0710681b8ac3f765f30cb1db60c9a7ed0df8 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hexdecoct.h"
 #include "io-util.h"
 #include "log.h"
index dfd17694c9b97510ec528e8dfa17f868490e4523..a931b10b9fad661c86eadddb347da8da4b0a9eaa 100644 (file)
@@ -55,6 +55,7 @@
 #include "fdset.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "hostname-setup.h"
 #include "ima-setup.h"
 #include "killall.h"
index 589501519aff1cc0f955a72cb05be7893cc265fe..a56162ab5bd4851153714198811103d5d7f371d8 100644 (file)
@@ -55,6 +55,7 @@
 #include "exit-status.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "io-util.h"
 #include "locale-setup.h"
index d5bd8869da705e08b8f6d345ebfd5efe1c7231c3..bb77f4502d1a672ceded22a71dbcf9dc252ef13e 100644 (file)
@@ -35,6 +35,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "load-dropin.h"
 #include "load-fragment.h"
 #include "log.h"
index 3ece2e056d1461193a56ce22955ab046a8a9b56c..26d94eb521757d57d67551107b907b8ab531e572 100644 (file)
@@ -24,6 +24,7 @@
 #include "bus-error.h"
 #include "bus-util.h"
 #include "dbus-timer.h"
+#include "fs-util.h"
 #include "parse-util.h"
 #include "special.h"
 #include "string-util.h"
index 590ab865152f2be4a124a2de991c0e9c33a9bd47..a40a92b5cb0ceac90ef91e54fb5bfd60b6c75dc8 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "dirent-util.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "log.h"
 #include "pager.h"
index 564bd50f9bd7eee0e05aaf523f5b386bcd4a38d4..8faed594c6fd609406084d851cc50b73e4d2c2de 100644 (file)
@@ -28,6 +28,7 @@
 #include "copy.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "locale-util.h"
 #include "mkdir.h"
index 7415be1529b7464b548d784d427ff24e21b38aaf..590ffafef68bc8bb692bc6ab5567743a6aab0b59 100644 (file)
@@ -37,6 +37,7 @@
 #include "bus-util.h"
 #include "device-util.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "process-util.h"
index b4118828a94f229c7293e824d113cc1efbe19c53..48d0883a3a6eea6b4a2c00fef9bcf5fc98f7d8cb 100644 (file)
@@ -25,6 +25,7 @@
 #include "conf-files.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hwdb-internal.h"
 #include "hwdb-util.h"
 #include "mkdir.h"
index 1ecd1e4e1008b401d1d1aae6b05bc48517aaddfc..6ff732d73f9b744669de4399f31954debeaa55d1 100644 (file)
@@ -27,6 +27,7 @@
 #include "export-raw.h"
 #include "export-tar.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "import-util.h"
 #include "machine-image.h"
index 0c81001dbec4cb6598b1963d3c9db82e4b496381..87f4a3935d58700fa24f035e66be9ccd51fb68a8 100644 (file)
@@ -29,6 +29,7 @@
 #include "copy.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "import-common.h"
 #include "import-compress.h"
index d88eae1973e69581af7e3b710d085520bf2248cc..64eb5ccd8337d4835a599eac54afeb7a9f136214 100644 (file)
@@ -28,6 +28,7 @@
 #include "copy.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "import-common.h"
 #include "import-compress.h"
index e50ded92198b481662f691e2837c28b48abea39b..76b38e4903dbce6be60ef03075746c08989b4cc4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "event-util.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "import-raw.h"
 #include "import-tar.h"
index 700462bfd2f3c45107c377d131905c854040e8d8..2420b9a5f43d15dead38b8291bb14dfdcf1bc348 100644 (file)
@@ -29,6 +29,7 @@
 #include "curl-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "import-common.h"
 #include "import-util.h"
index 39759b50b04210d1e881833a7ba547d25c17b224..0e9b5ca2b250f4a71ba5f95397825f26024e6db9 100644 (file)
@@ -31,6 +31,7 @@
 #include "curl-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "import-common.h"
 #include "import-util.h"
index 3e21d72157e90b8b47ac4307daa5db0e8e39bb1d..306fbe720a2b5dea8afc55ed146da4fc6f26dc4b 100644 (file)
@@ -29,6 +29,7 @@
 #include "curl-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "import-common.h"
 #include "import-util.h"
index ec57920d2e05667e8fb2f773d7e462a3cdaf36f1..1756a823a92d0f0df5f0cf1414cddc4a3fed937f 100644 (file)
@@ -44,6 +44,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "journald-native.h"
 #include "log.h"
 #include "macro.h"
index ef5518136a52ba273c70c5ac3e3177db99bba31a..61d502f0a1465ebdbca8ad86ac8be1bc527a495e 100644 (file)
@@ -45,6 +45,7 @@
 #include "chattr-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "fsprg.h"
 #include "hostname-util.h"
 #include "io-util.h"
index ae229ecaf54af5aca029a98fa3a2a5da223f0bf8..e427f20e69ed25300b7c3ed04398abda0a9c9cc5 100644 (file)
@@ -25,6 +25,7 @@
 #include <unistd.h>
 
 #include "fd-util.h"
+#include "fs-util.h"
 #include "journald-console.h"
 #include "journald-kmsg.h"
 #include "journald-native.h"
index 6e6d9c1c4ac35a72616f7949eec4bf8de25f1ffb..a474293a8730a6da709cea1180de5796b39885cd 100644 (file)
@@ -40,6 +40,7 @@
 #include "extract-word.h"
 #include "fd-util.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "hostname-util.h"
 #include "journal-authenticate.h"
index a125be7cb872f8da4a523bd1c748f6288296131c..49fac7bdccf13ab75319db93cf0a9cd587cd5acd 100644 (file)
@@ -36,6 +36,7 @@
 #include "sd-daemon.h"
 
 #include "fd-util.h"
+#include "fs-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "socket-util.h"
index 91690d83f68f93006fdf781bde47d82ec0ad553c..da325c9d2814e6a392ac52d8374d82167aebac3b 100644 (file)
@@ -29,6 +29,7 @@
 #include "device-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "macro.h"
 #include "mkdir.h"
index 0e7a26523d4a57ae1e0cd916d685db05ae830c00..13d1baa41d8d580414835cad1f673f30ee966d79 100644 (file)
@@ -29,6 +29,7 @@
 #include "device-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "macro.h"
 #include "parse-util.h"
index 90ee26307987e6eaff3dc78c20899a4ffdecd689..6b98a7c17856ee6873c8309ea534bccfee9a4dcb 100644 (file)
 #include "sd-login.h"
 
 #include "cgroup-util.h"
+#include "dirent-util.h"
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "io-util.h"
 #include "login-util.h"
@@ -43,7 +45,6 @@
 #include "strv.h"
 #include "user-util.h"
 #include "util.h"
-#include "dirent-util.h"
 
 /* Error codes:
  *
index 2fcf4900d3c2eb1223a9d515dbcf67f1b78333ca..284ec421380f0c6bc64d72f00d1ef3a76d071c68 100644 (file)
@@ -36,6 +36,7 @@
 #include "fd-util.h"
 #include "fileio-label.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "logind.h"
 #include "mkdir.h"
 #include "path-util.h"
index 5a7ae11ec149753e7336c9390ba976aa134aac65..925190b603fb250dbfff324aa666fa6ea3fdd01a 100644 (file)
@@ -32,6 +32,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "label.h"
 #include "logind-user.h"
index c17a98e90fa4182dfdd9a4bc4253c547c5d338f4..0003b84dd5b90c9f85d37ec83c3cf1d1bbdf89fc 100644 (file)
@@ -38,6 +38,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "in-addr-util.h"
 #include "local-addresses.h"
 #include "machine-dbus.h"
index ac9c31b931fcf223a2016494c11c5d47aff60207..01e9a67d762ccdb55f2232abf58bf0d177c213ee 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "cgroup-util.h"
 #include "escape.h"
+#include "fs-util.h"
 #include "label.h"
 #include "mkdir.h"
 #include "mount-util.h"
index c34d52293de6640739300006d237630fa803f6da..c7ec511cca738481cc8e7e8105b9174caf809537 100644 (file)
@@ -61,6 +61,7 @@
 #include "fdset.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "gpt.h"
 #include "hostname-util.h"
 #include "log.h"
index 8bb33add720ec2cf942edabc4d746692ccc6b87f..4235e95d92c72fa2aa8ce67bcf9cbee1f0798ff2 100644 (file)
@@ -29,6 +29,7 @@
 #include "conf-files.h"
 #include "conf-parser.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "log.h"
 #include "macro.h"
 #include "parse-util.h"
index bfafb59008e30a45a050a3e700fbd14e4539eeac..454fe79aa1a299229e77a47f9b7a498df9461b60 100644 (file)
@@ -29,6 +29,7 @@
 #include "conf-parser.h"
 #include "dirent-util.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "install-printf.h"
 #include "install.h"
index c5444ee0102abc12ee7fb7ab7909ef8f002af751..3f12a67b54fdce5b2a5d31897ee2dd143f971447 100644 (file)
@@ -28,6 +28,7 @@
 #include "copy.h"
 #include "dirent-util.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "machine-image.h"
 #include "mkdir.h"
 #include "path-util.h"
index 9270f224793184ce080558b9cfba44858258cb96..6be1b7b2648cde27250885ddbff5421815f87940 100644 (file)
 #include "btrfs-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "lockfile-util.h"
 #include "machine-pool.h"
 #include "mkdir.h"
+#include "mount-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "process-util.h"
 #include "signal-util.h"
 #include "string-util.h"
 #include "util.h"
-#include "mount-util.h"
 
 #define VAR_LIB_MACHINES_SIZE_START (1024UL*1024UL*500UL)
 #define VAR_LIB_MACHINES_FREE_MIN (1024UL*1024UL*750UL)
index 794aa1a0c7fcb6f1a6b04e1e57b2aea295689170..6c2f53774dede2d608497225d3a6d81de10ba961 100644 (file)
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include "fs-util.h"
 #include "log.h"
 #include "string-util.h"
 #include "util.h"
index 77a05ca346a230e127dbdde8223b942ebe3a1253..2b1caa619920601aec6e3d2a3687f015c259d565 100644 (file)
@@ -51,6 +51,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "hostname-util.h"
 #include "initreq.h"
 #include "install.h"
index 30ba5364c449e83b62fc8c1b4411df5ecfdea7a2..d00517e929cbaf1e1dc87a78201a34b0f3c15e94 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdio.h>
 
 #include "conf-files.h"
+#include "fs-util.h"
 #include "macro.h"
 #include "rm-rf.h"
 #include "string-util.h"
index 1bd50edca242e2c5fca88d05656a2bcda6f9a775..4ccf729e80b67ea566bc1c5c6077c4c8be13ee55 100644 (file)
@@ -22,6 +22,7 @@
 #include "copy.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "macro.h"
 #include "mkdir.h"
 #include "path-util.h"
index fa6336f1fbf69b7ac5a99a8090cb9eb7d16f6eb9..cdbfe6698e00440d6ffb50d6fa28c4548165b17b 100644 (file)
 
 #include <stdio.h>
 
-#include "unit.h"
-#include "manager.h"
-#include "util.h"
+#include "fs-util.h"
 #include "macro.h"
+#include "manager.h"
 #include "mkdir.h"
 #include "rm-rf.h"
+#include "unit.h"
+#include "util.h"
 
 typedef void (*test_function_t)(Manager *m);
 
index e9e0bfd41d8b24ca58cc79449712a9c369759b02..405434c1ffd405dfb98bab61cbe40be7e77b1bcd 100644 (file)
@@ -20,6 +20,8 @@
 #include <stdbool.h>
 #include <stdio.h>
 
+#include "fd-util.h"
+#include "fs-util.h"
 #include "macro.h"
 #include "manager.h"
 #include "mkdir.h"
@@ -28,7 +30,6 @@
 #include "strv.h"
 #include "unit.h"
 #include "util.h"
-#include "fd-util.h"
 
 typedef void (*test_function_t)(Manager *m);
 
index 3b9f71e3a265d5ab1e7b43f18f84d2dbd781f338..219d659b416183f19544ec24d498ca2ffac3439b 100644 (file)
@@ -26,6 +26,7 @@
 #include <sys/signalfd.h>
 #include <unistd.h>
 
+#include "fs-util.h"
 #include "missing.h"
 #include "selinux-util.h"
 #include "signal-util.h"
index 2e266bb047de1e00d7ddf912c49f3623804ac1d2..d6fe7cd997b5e033be0f4ff231e5cef99365962c 100644 (file)
@@ -37,6 +37,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "fstab-util.h"
 #include "hexdecoct.h"
 #include "io-util.h"
index 6de9e246f65e364f03708986085b8fe861b279f2..e97dc97ae12d2662699298804597ada71dcc714c 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
-#include "sd-messages.h"
-#include "sd-event.h"
 #include "sd-bus.h"
+#include "sd-event.h"
+#include "sd-messages.h"
 
-#include "util.h"
-#include "strv.h"
-#include "def.h"
-#include "clock-util.h"
-#include "path-util.h"
-#include "fileio-label.h"
-#include "bus-util.h"
-#include "bus-error.h"
 #include "bus-common-errors.h"
+#include "bus-error.h"
+#include "bus-util.h"
+#include "clock-util.h"
+#include "def.h"
 #include "event-util.h"
+#include "fileio-label.h"
+#include "fs-util.h"
+#include "path-util.h"
 #include "selinux-util.h"
+#include "strv.h"
+#include "util.h"
 
 #define NULL_ADJTIME_UTC "0.0 0 0\n0\nUTC\n"
 #define NULL_ADJTIME_LOCAL "0.0 0 0\n0\nLOCAL\n"
index d44cf0a80bfe86b60c381e7aca09cd5c7f7f5f20..15ca006debb1a608f61001c0f18646602bfc4aa6 100644 (file)
@@ -34,6 +34,7 @@
 #include "sd-daemon.h"
 
 #include "fd-util.h"
+#include "fs-util.h"
 #include "list.h"
 #include "log.h"
 #include "missing.h"
index 7a0ab18ca012908d0b992a4ee98327e00c693281..59d348c3569558cf9e2eac7ee538e6cffac5923c 100644 (file)
@@ -25,6 +25,7 @@
 #include "capability.h"
 #include "clock-util.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "network-util.h"
 #include "signal-util.h"
 #include "timesyncd-conf.h"
index 8cf327a15f5d275d87be3d13c32fffcb4850584d..090864becd26f442b75a5259fc0998077993465c 100644 (file)
@@ -48,6 +48,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "io-util.h"
 #include "label.h"
 #include "log.h"
index 4ed6416ecdf4f7023b3dec9afee578e215157604..afdeb0a21beabb65dd0d9ec84d406d6f9680a58d 100644 (file)
@@ -26,6 +26,7 @@
 #include <unistd.h>
 
 #include "formats-util.h"
+#include "fs-util.h"
 #include "selinux-util.h"
 #include "smack-util.h"
 #include "string-util.h"
index 69aff7b57983bbef1d881e3f0008934e72d2b2ab..87468c43aefed813e64dd758a51ec1ed3b535d36 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "conf-files.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hwdb-internal.h"
 #include "hwdb-util.h"
 #include "strbuf.h"
index f1fc1cd0821eb67919e338add444510092f1b92f..90e1de7b7af846c475c295a075595260b9dcd8a7 100644 (file)
@@ -50,6 +50,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "formats-util.h"
+#include "fs-util.h"
 #include "hashmap.h"
 #include "io-util.h"
 #include "netlink-util.h"