summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/acl-util.c1
-rw-r--r--src/shared/acpi-fpdt.c1
-rw-r--r--src/shared/apparmor-util.c7
-rw-r--r--src/shared/architecture.c1
-rw-r--r--src/shared/ask-password-api.c3
-rw-r--r--src/shared/base-filesystem.c7
-rw-r--r--src/shared/bus-util.c8
-rw-r--r--src/shared/cgroup-show.c2
-rw-r--r--src/shared/clean-ipc.c2
-rw-r--r--src/shared/condition.c9
-rw-r--r--src/shared/conf-parser.c9
-rw-r--r--src/shared/dev-setup.c6
-rw-r--r--src/shared/dns-domain.c5
-rw-r--r--src/shared/dropin.c2
-rw-r--r--src/shared/efivars.c4
-rw-r--r--src/shared/firewall-util.c3
-rw-r--r--src/shared/fstab-util.c63
-rw-r--r--src/shared/fstab-util.h7
-rw-r--r--src/shared/generator.c2
-rw-r--r--src/shared/import-util.c5
-rw-r--r--src/shared/install-printf.c1
-rw-r--r--src/shared/install.c16
-rw-r--r--src/shared/logs-show.c3
-rw-r--r--src/shared/machine-image.c6
-rw-r--r--src/shared/machine-pool.c6
-rw-r--r--src/shared/pager.c1
-rw-r--r--src/shared/path-lookup.c1
-rw-r--r--src/shared/ptyfwd.c1
-rw-r--r--src/shared/sleep-config.c2
-rw-r--r--src/shared/spawn-polkit-agent.c6
-rw-r--r--src/shared/specifier.c3
-rw-r--r--src/shared/switch-root.c1
-rw-r--r--src/shared/utmp-wtmp.c1
33 files changed, 170 insertions, 25 deletions
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c
index e8931daee2..79f5a60579 100644
--- a/src/shared/acl-util.c
+++ b/src/shared/acl-util.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <stdbool.h>
+#include "alloc-util.h"
#include "acl-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index b3d2f96885..8e36067f74 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <unistd.h>
+#include "alloc-util.h"
#include "acpi-fpdt.h"
#include "fd-util.h"
#include "fileio.h"
diff --git a/src/shared/apparmor-util.c b/src/shared/apparmor-util.c
index c2bbd330bd..f6ac43adfe 100644
--- a/src/shared/apparmor-util.c
+++ b/src/shared/apparmor-util.c
@@ -19,10 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-
-#include "util.h"
-#include "fileio.h"
+#include "alloc-util.h"
#include "apparmor-util.h"
+#include "fileio.h"
+#include "parse-util.h"
+#include "util.h"
bool mac_apparmor_use(void) {
static int cached_use = -1;
diff --git a/src/shared/architecture.c b/src/shared/architecture.c
index e5efcd77b6..e2efa4272b 100644
--- a/src/shared/architecture.c
+++ b/src/shared/architecture.c
@@ -21,6 +21,7 @@
#include <sys/utsname.h>
+#include "string-table.h"
#include "string-util.h"
#include "architecture.h"
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 15203d21ea..c96dbf877a 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -32,8 +32,10 @@
#include <termios.h>
#include <unistd.h>
+#include "alloc-util.h"
#include "ask-password-api.h"
#include "fd-util.h"
+#include "fileio.h"
#include "formats-util.h"
#include "io-util.h"
#include "missing.h"
@@ -44,6 +46,7 @@
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
+#include "umask-util.h"
#include "util.h"
#define KEYRING_TIMEOUT_USEC ((5 * USEC_PER_MINUTE) / 2)
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index 751dfdec45..e605490c32 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -24,12 +24,15 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "alloc-util.h"
+#include "base-filesystem.h"
+#include "fd-util.h"
#include "log.h"
#include "macro.h"
#include "string-util.h"
+#include "umask-util.h"
+#include "user-util.h"
#include "util.h"
-#include "base-filesystem.h"
-#include "fd-util.h"
typedef struct BaseFilesystem {
const char *dir;
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 604b8f248a..940e393318 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -25,6 +25,7 @@
#include "sd-daemon.h"
#include "sd-event.h"
+#include "alloc-util.h"
#include "bus-error.h"
#include "bus-internal.h"
#include "bus-label.h"
@@ -37,12 +38,19 @@
#include "fd-util.h"
#include "macro.h"
#include "missing.h"
+#include "parse-util.h"
#include "path-util.h"
+#include "proc-cmdline.h"
+#include "process-util.h"
+#include "rlimit-util.h"
#include "set.h"
#include "signal-util.h"
+#include "stdio-util.h"
#include "string-util.h"
#include "strv.h"
+#include "syslog-util.h"
#include "unit-name.h"
+#include "user-util.h"
#include "utf8.h"
#include "util.h"
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 395e41930c..129ffc7056 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -24,10 +24,12 @@
#include <stdio.h>
#include <string.h>
+#include "alloc-util.h"
#include "cgroup-show.h"
#include "cgroup-util.h"
#include "fd-util.h"
#include "formats-util.h"
+#include "locale-util.h"
#include "macro.h"
#include "path-util.h"
#include "process-util.h"
diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c
index fe3187384f..c60f605997 100644
--- a/src/shared/clean-ipc.c
+++ b/src/shared/clean-ipc.c
@@ -30,10 +30,12 @@
#include "clean-ipc.h"
#include "fd-util.h"
+#include "fileio.h"
#include "formats-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
+#include "dirent-util.h"
static int clean_sysvipc_shm(uid_t delete_uid) {
_cleanup_fclose_ FILE *f = NULL;
diff --git a/src/shared/condition.c b/src/shared/condition.c
index b8915dab8a..a69719116c 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -27,18 +27,25 @@
#include "sd-id128.h"
+#include "alloc-util.h"
#include "apparmor-util.h"
#include "architecture.h"
-#include "audit.h"
+#include "audit-util.h"
#include "cap-list.h"
#include "condition.h"
#include "extract-word.h"
#include "fd-util.h"
+#include "glob-util.h"
#include "hostname-util.h"
#include "ima-util.h"
+#include "mount-util.h"
+#include "parse-util.h"
#include "path-util.h"
+#include "proc-cmdline.h"
#include "selinux-util.h"
#include "smack-util.h"
+#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 1b47c0ab52..3f8eaf7d9a 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -26,17 +26,22 @@
#include "sd-messages.h"
+#include "alloc-util.h"
#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"
#include "path-util.h"
+#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
+#include "syslog-util.h"
#include "utf8.h"
#include "util.h"
-#include "conf-parser.h"
-#include "fd-util.h"
int config_item_table_lookup(
const void *table,
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c
index 25ad918b85..ad3c17d5bd 100644
--- a/src/shared/dev-setup.c
+++ b/src/shared/dev-setup.c
@@ -23,10 +23,12 @@
#include <stdlib.h>
#include <unistd.h>
-#include "util.h"
+#include "alloc-util.h"
+#include "dev-setup.h"
#include "label.h"
#include "path-util.h"
-#include "dev-setup.h"
+#include "user-util.h"
+#include "util.h"
int dev_setup(const char *prefix, uid_t uid, gid_t gid) {
static const char symlinks[] =
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index d4df9d2acb..7af15e0098 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -24,8 +24,11 @@
#include <stringprep.h>
#endif
-#include "string-util.h"
+#include "alloc-util.h"
#include "dns-domain.h"
+#include "hexdecoct.h"
+#include "parse-util.h"
+#include "string-util.h"
int dns_label_unescape(const char **name, char *dest, size_t sz) {
const char *n;
diff --git a/src/shared/dropin.c b/src/shared/dropin.c
index 1836e91acd..0d44401cc2 100644
--- a/src/shared/dropin.c
+++ b/src/shared/dropin.c
@@ -19,12 +19,14 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "alloc-util.h"
#include "conf-files.h"
#include "dropin.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio-label.h"
#include "mkdir.h"
+#include "path-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 4808ede60c..86bb0b57c3 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -23,9 +23,13 @@
#include <string.h>
#include <fcntl.h>
+#include "alloc-util.h"
+#include "dirent-util.h"
#include "efivars.h"
#include "fd-util.h"
#include "io-util.h"
+#include "parse-util.h"
+#include "stdio-util.h"
#include "utf8.h"
#include "util.h"
#include "virt.h"
diff --git a/src/shared/firewall-util.c b/src/shared/firewall-util.c
index effc6e8e70..e178287872 100644
--- a/src/shared/firewall-util.c
+++ b/src/shared/firewall-util.c
@@ -27,8 +27,9 @@
#include <linux/netfilter/xt_addrtype.h>
#include <libiptc/libiptc.h>
-#include "util.h"
+#include "alloc-util.h"
#include "firewall-util.h"
+#include "util.h"
DEFINE_TRIVIAL_CLEANUP_FUNC(struct xtc_handle*, iptc_free);
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
index bdfc13e3cd..eb2845cddf 100644
--- a/src/shared/fstab-util.c
+++ b/src/shared/fstab-util.c
@@ -19,11 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "alloc-util.h"
+#include "device-nodes.h"
+#include "fstab-util.h"
+#include "mount-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
-#include "fstab-util.h"
bool fstab_is_mount_point(const char *mount) {
_cleanup_endmntent_ FILE *f = NULL;
@@ -195,3 +199,60 @@ int fstab_find_pri(const char *options, int *ret) {
*ret = (int) pri;
return 1;
}
+
+static char *unquote(const char *s, const char* quotes) {
+ size_t l;
+ assert(s);
+
+ /* This is rather stupid, simply removes the heading and
+ * trailing quotes if there is one. Doesn't care about
+ * escaping or anything.
+ *
+ * DON'T USE THIS FOR NEW CODE ANYMORE!*/
+
+ l = strlen(s);
+ if (l < 2)
+ return strdup(s);
+
+ if (strchr(quotes, s[0]) && s[l-1] == s[0])
+ return strndup(s+1, l-2);
+
+ return strdup(s);
+}
+
+static char *tag_to_udev_node(const char *tagvalue, const char *by) {
+ _cleanup_free_ char *t = NULL, *u = NULL;
+ size_t enc_len;
+
+ u = unquote(tagvalue, QUOTES);
+ if (!u)
+ return NULL;
+
+ enc_len = strlen(u) * 4 + 1;
+ t = new(char, enc_len);
+ if (!t)
+ return NULL;
+
+ if (encode_devnode_name(u, t, enc_len) < 0)
+ return NULL;
+
+ return strjoin("/dev/disk/by-", by, "/", t, NULL);
+}
+
+char *fstab_node_to_udev_node(const char *p) {
+ assert(p);
+
+ if (startswith(p, "LABEL="))
+ return tag_to_udev_node(p+6, "label");
+
+ if (startswith(p, "UUID="))
+ return tag_to_udev_node(p+5, "uuid");
+
+ if (startswith(p, "PARTUUID="))
+ return tag_to_udev_node(p+9, "partuuid");
+
+ if (startswith(p, "PARTLABEL="))
+ return tag_to_udev_node(p+10, "partlabel");
+
+ return strdup(p);
+}
diff --git a/src/shared/fstab-util.h b/src/shared/fstab-util.h
index 872b2363cd..5ebea44019 100644
--- a/src/shared/fstab-util.h
+++ b/src/shared/fstab-util.h
@@ -23,11 +23,12 @@
#include <stdbool.h>
#include <stddef.h>
+
#include "macro.h"
bool fstab_is_mount_point(const char *mount);
-int fstab_filter_options(const char *opts, const char *names,
- const char **namefound, char **value, char **filtered);
+
+int fstab_filter_options(const char *opts, const char *names, const char **namefound, char **value, char **filtered);
int fstab_extract_values(const char *opts, const char *name, char ***values);
@@ -49,3 +50,5 @@ static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no
return opt == yes_no;
}
+
+char *fstab_node_to_udev_node(const char *p);
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 0a8e282949..cb4ebc606e 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -21,6 +21,7 @@
#include <unistd.h>
+#include "alloc-util.h"
#include "dropin.h"
#include "escape.h"
#include "fd-util.h"
@@ -28,6 +29,7 @@
#include "fstab-util.h"
#include "generator.h"
#include "mkdir.h"
+#include "mount-util.h"
#include "path-util.h"
#include "special.h"
#include "string-util.h"
diff --git a/src/shared/import-util.c b/src/shared/import-util.c
index c4c66c847d..ddc8c00a2d 100644
--- a/src/shared/import-util.c
+++ b/src/shared/import-util.c
@@ -19,10 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "alloc-util.h"
#include "btrfs-util.h"
+#include "import-util.h"
+#include "path-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
-#include "import-util.h"
int import_url_last_component(const char *url, char **ret) {
const char *e, *p;
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index 224874f65c..e1cb5d27ff 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
+#include "alloc-util.h"
#include "formats-util.h"
#include "install-printf.h"
#include "specifier.h"
diff --git a/src/shared/install.c b/src/shared/install.c
index 9b72f76662..c74efede76 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -25,21 +25,26 @@
#include <string.h>
#include <unistd.h>
+#include "alloc-util.h"
#include "conf-files.h"
#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"
#include "mkdir.h"
#include "path-lookup.h"
#include "path-util.h"
#include "set.h"
#include "special.h"
+#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "util.h"
-#include "install.h"
-#include "fd-util.h"
typedef struct {
OrderedHashmap *will_install;
@@ -48,13 +53,12 @@ typedef struct {
static int in_search_path(const char *path, char **search) {
_cleanup_free_ char *parent = NULL;
- int r;
assert(path);
- r = path_get_parent(path, &parent);
- if (r < 0)
- return r;
+ parent = dirname_malloc(path);
+ if (!parent)
+ return -ENOMEM;
return strv_contains(search, parent);
}
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index d8ea4c9f92..0313b0946f 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -25,6 +25,7 @@
#include <sys/socket.h>
#include <time.h>
+#include "alloc-util.h"
#include "fd-util.h"
#include "formats-util.h"
#include "hashmap.h"
@@ -33,7 +34,9 @@
#include "journal-internal.h"
#include "log.h"
#include "logs-show.h"
+#include "parse-util.h"
#include "process-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "terminal-util.h"
#include "utf8.h"
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 415d939fc6..2c1da0a40d 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -23,16 +23,22 @@
#include <linux/fs.h>
#include <sys/statfs.h>
+#include "alloc-util.h"
#include "btrfs-util.h"
+#include "chattr-util.h"
#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"
#include "rm-rf.h"
+#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
+#include "xattr-util.h"
static const char image_search_path[] =
"/var/lib/machines\0"
diff --git a/src/shared/machine-pool.c b/src/shared/machine-pool.c
index a2cb5fc5a0..60b1b3092d 100644
--- a/src/shared/machine-pool.c
+++ b/src/shared/machine-pool.c
@@ -24,14 +24,20 @@
#include <sys/statvfs.h>
#include <sys/vfs.h>
+#include "alloc-util.h"
#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 "stat-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 7029d6b2e2..d149bc1722 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -27,6 +27,7 @@
#include "copy.h"
#include "fd-util.h"
+#include "locale-util.h"
#include "macro.h"
#include "pager.h"
#include "process-util.h"
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 1e63c72047..d71f379e76 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <errno.h>
+#include "alloc-util.h"
#include "util.h"
#include "strv.h"
#include "path-util.h"
diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c
index e5e0f37adf..786752ea94 100644
--- a/src/shared/ptyfwd.c
+++ b/src/shared/ptyfwd.c
@@ -24,6 +24,7 @@
#include <limits.h>
#include <termios.h>
+#include "alloc-util.h"
#include "fd-util.h"
#include "ptyfwd.h"
#include "util.h"
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index b5cb9508bf..bbbb3460d4 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -21,6 +21,7 @@
#include <stdio.h>
+#include "alloc-util.h"
#include "conf-parser.h"
#include "fd-util.h"
#include "fileio.h"
@@ -29,6 +30,7 @@
#include "string-util.h"
#include "strv.h"
#include "util.h"
+#include "parse-util.h"
#define USE(x, y) do{ (x) = (y); (y) = NULL; } while(0)
diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c
index 7cc9e7ccc1..ec6e5a8312 100644
--- a/src/shared/spawn-polkit-agent.c
+++ b/src/shared/spawn-polkit-agent.c
@@ -30,6 +30,7 @@
#include "log.h"
#include "process-util.h"
#include "spawn-polkit-agent.h"
+#include "stdio-util.h"
#include "util.h"
#ifdef ENABLE_POLKIT
@@ -78,8 +79,9 @@ void polkit_agent_close(void) {
return;
/* Inform agent that we are done */
- kill(agent_pid, SIGTERM);
- kill(agent_pid, SIGCONT);
+ (void) kill(agent_pid, SIGTERM);
+ (void) kill(agent_pid, SIGCONT);
+
(void) wait_for_terminate(agent_pid, NULL);
agent_pid = 0;
}
diff --git a/src/shared/specifier.c b/src/shared/specifier.c
index 610aec0df5..c5c4a4d7d7 100644
--- a/src/shared/specifier.c
+++ b/src/shared/specifier.c
@@ -22,11 +22,12 @@
#include <string.h>
#include <sys/utsname.h>
+#include "alloc-util.h"
#include "hostname-util.h"
#include "macro.h"
+#include "specifier.h"
#include "string-util.h"
#include "util.h"
-#include "specifier.h"
/*
* Generic infrastructure for replacing %x style specifiers in
diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index 60d7043fda..fc885f6cb8 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -35,6 +35,7 @@
#include "rm-rf.h"
#include "string-util.h"
#include "switch-root.h"
+#include "user-util.h"
#include "util.h"
int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, unsigned long mountflags) {
diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c
index 1e6ac2f27d..13b32a0509 100644
--- a/src/shared/utmp-wtmp.c
+++ b/src/shared/utmp-wtmp.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <utmpx.h>
+#include "alloc-util.h"
#include "fd-util.h"
#include "hostname-util.h"
#include "macro.h"