diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/automount.c | 1 | ||||
-rw-r--r-- | src/core/bus-policy.c | 5 | ||||
-rw-r--r-- | src/core/dbus-mount.c | 2 | ||||
-rw-r--r-- | src/core/execute.c | 2 | ||||
-rw-r--r-- | src/core/load-fragment-gperf.gperf.m4 | 2 | ||||
-rw-r--r-- | src/core/machine-id-setup.c | 1 | ||||
-rw-r--r-- | src/core/main.c | 1 | ||||
-rw-r--r-- | src/core/manager.c | 1 | ||||
-rw-r--r-- | src/core/mount.c | 12 | ||||
-rw-r--r-- | src/core/mount.h | 2 | ||||
-rw-r--r-- | src/core/namespace.c | 1 | ||||
-rw-r--r-- | src/core/socket.c | 1 | ||||
-rw-r--r-- | src/core/timer.c | 3 | ||||
-rw-r--r-- | src/core/umount.c | 26 | ||||
-rw-r--r-- | src/core/unit-printf.c | 3 | ||||
-rw-r--r-- | src/core/unit.c | 3 |
16 files changed, 46 insertions, 20 deletions
diff --git a/src/core/automount.c b/src/core/automount.c index c25038ca50..d362d6579d 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -36,6 +36,7 @@ #include "dbus-automount.h" #include "fd-util.h" #include "formats-util.h" +#include "io-util.h" #include "label.h" #include "mkdir.h" #include "mount.h" diff --git a/src/core/bus-policy.c b/src/core/bus-policy.c index a6a8fcd4d3..2490903a8c 100644 --- a/src/core/bus-policy.c +++ b/src/core/bus-policy.c @@ -19,10 +19,11 @@ #include <stdlib.h> -#include "kdbus.h" -#include "util.h" #include "bus-kernel.h" #include "bus-policy.h" +#include "kdbus.h" +#include "user-util.h" +#include "util.h" int bus_kernel_translate_access(BusPolicyAccess access) { assert(access >= 0); diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c index 318e81abd6..0c91850c52 100644 --- a/src/core/dbus-mount.c +++ b/src/core/dbus-mount.c @@ -118,7 +118,7 @@ const sd_bus_vtable bus_mount_vtable[] = { SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(Mount, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Mount, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("SloppyOptions", "b", bus_property_get_bool, offsetof(Mount, sloppy_options), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_PROPERTY("SmackFileSystemRoot", "s", NULL, offsetof(Mount, smack_fs_root), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("SmackFileSystemRootLabel", "s", NULL, offsetof(Mount, smack_fs_root_label), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Mount, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), BUS_EXEC_COMMAND_VTABLE("ExecMount", offsetof(Mount, exec_command[MOUNT_EXEC_MOUNT]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), BUS_EXEC_COMMAND_VTABLE("ExecUnmount", offsetof(Mount, exec_command[MOUNT_EXEC_UNMOUNT]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), diff --git a/src/core/execute.c b/src/core/execute.c index 83ae3f6253..3f2607ff1a 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -69,6 +69,7 @@ #include "fd-util.h" #include "fileio.h" #include "formats-util.h" +#include "io-util.h" #include "ioprio.h" #include "log.h" #include "macro.h" @@ -89,6 +90,7 @@ #include "strv.h" #include "terminal-util.h" #include "unit.h" +#include "user-util.h" #include "util.h" #include "utmp-wtmp.h" diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index 507cfdde75..c3b48aec4c 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -319,7 +319,7 @@ Mount.Type, config_parse_string, 0, Mount.TimeoutSec, config_parse_sec, 0, offsetof(Mount, timeout_usec) Mount.DirectoryMode, config_parse_mode, 0, offsetof(Mount, directory_mode) Mount.SloppyOptions, config_parse_bool, 0, offsetof(Mount, sloppy_options) -Mount.SmackFileSystemRoot, config_parse_string, 0, offsetof(Mount, smack_fs_root) +Mount.SmackFileSystemRootLabel, config_parse_string, 0, offsetof(Mount, smack_fs_root_label) EXEC_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl CGROUP_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl KILL_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c index f59bf56c73..c72892b343 100644 --- a/src/core/machine-id-setup.c +++ b/src/core/machine-id-setup.c @@ -31,6 +31,7 @@ #include "fd-util.h" #include "fileio.h" +#include "io-util.h" #include "log.h" #include "machine-id-setup.h" #include "macro.h" diff --git a/src/core/main.c b/src/core/main.c index 68ec730406..b0ca6fa10e 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -76,6 +76,7 @@ #include "strv.h" #include "switch-root.h" #include "terminal-util.h" +#include "user-util.h" #include "virt.h" #include "watchdog.h" diff --git a/src/core/manager.c b/src/core/manager.c index 400c66977b..287676ff27 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -55,6 +55,7 @@ #include "exit-status.h" #include "fd-util.h" #include "hashmap.h" +#include "io-util.h" #include "locale-setup.h" #include "log.h" #include "macro.h" diff --git a/src/core/mount.c b/src/core/mount.c index 47dd680b93..ebdb3503e9 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -206,7 +206,7 @@ static void mount_done(Unit *u) { assert(m); m->where = mfree(m->where); - m->smack_fs_root = mfree(m->smack_fs_root); + m->smack_fs_root_label = mfree(m->smack_fs_root_label); mount_parameters_done(&m->parameters_proc_self_mountinfo); mount_parameters_done(&m->parameters_fragment); @@ -672,7 +672,7 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) { "%sFrom /proc/self/mountinfo: %s\n" "%sFrom fragment: %s\n" "%sDirectoryMode: %04o\n" - "%sSmackFileSystemRoot: %s\n", + "%sSmackFileSystemRootLabel: %s\n", prefix, mount_state_to_string(m->state), prefix, mount_result_to_string(m->result), prefix, m->where, @@ -682,7 +682,7 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) { prefix, yes_no(m->from_proc_self_mountinfo), prefix, yes_no(m->from_fragment), prefix, m->directory_mode, - prefix, strna(m->smack_fs_root)); + prefix, strna(m->smack_fs_root_label)); if (m->control_pid > 0) fprintf(f, @@ -868,12 +868,12 @@ static int mount_get_opts(Mount *m, char **_opts) { if (r < 0) return r; - if (mac_smack_use() && m->smack_fs_root) { + if (mac_smack_use() && m->smack_fs_root_label) { if (!isempty(o)) { - opts = strjoin(o, ",", "smackfsroot=", m->smack_fs_root, NULL); + opts = strjoin(o, ",", "smackfsroot=", m->smack_fs_root_label, NULL); free(o); } else - opts = strjoin("smackfsroot=", m->smack_fs_root, NULL); + opts = strjoin("smackfsroot=", m->smack_fs_root_label, NULL); if (!opts) return -ENOMEM; diff --git a/src/core/mount.h b/src/core/mount.h index 4e28810f6c..b344b5aa13 100644 --- a/src/core/mount.h +++ b/src/core/mount.h @@ -71,7 +71,7 @@ struct Mount { bool reset_cpu_usage:1; bool sloppy_options; - char *smack_fs_root; + char *smack_fs_root_label; MountResult result; MountResult reload_result; diff --git a/src/core/namespace.c b/src/core/namespace.c index 470f384056..4d11d54bfe 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -36,6 +36,7 @@ #include "namespace.h" #include "path-util.h" #include "selinux-util.h" +#include "socket-util.h" #include "string-util.h" #include "strv.h" #include "util.h" diff --git a/src/core/socket.c b/src/core/socket.c index e2085dac1c..7f401025ed 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -54,6 +54,7 @@ #include "unit-name.h" #include "unit-printf.h" #include "unit.h" +#include "user-util.h" static const UnitActiveState state_translation_table[_SOCKET_STATE_MAX] = { [SOCKET_DEAD] = UNIT_INACTIVE, diff --git a/src/core/timer.c b/src/core/timer.c index 4548a4fa52..908d45ac73 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -26,9 +26,10 @@ #include "dbus-timer.h" #include "special.h" #include "string-util.h" +#include "timer.h" #include "unit-name.h" #include "unit.h" -#include "timer.h" +#include "user-util.h" static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = { [TIMER_DEAD] = UNIT_INACTIVE, diff --git a/src/core/umount.c b/src/core/umount.c index 0e61bcaebb..8735bed7b1 100644 --- a/src/core/umount.c +++ b/src/core/umount.c @@ -31,6 +31,7 @@ #include "escape.h" #include "fd-util.h" +#include "fstab-util.h" #include "list.h" #include "mount-setup.h" #include "path-util.h" @@ -42,6 +43,7 @@ typedef struct MountPoint { char *path; + char *options; dev_t devnum; LIST_FIELDS(struct MountPoint, mount_point); } MountPoint; @@ -75,7 +77,7 @@ static int mount_points_list_get(MountPoint **head) { return -errno; for (i = 1;; i++) { - _cleanup_free_ char *path = NULL; + _cleanup_free_ char *path = NULL, *options = NULL; char *p = NULL; MountPoint *m; int k; @@ -86,15 +88,15 @@ static int mount_points_list_get(MountPoint **head) { "%*s " /* (3) major:minor */ "%*s " /* (4) root */ "%ms " /* (5) mount point */ - "%*s" /* (6) mount options */ + "%*s" /* (6) mount flags */ "%*[^-]" /* (7) optional fields */ "- " /* (8) separator */ "%*s " /* (9) file system type */ "%*s" /* (10) mount source */ - "%*s" /* (11) mount options 2 */ + "%ms" /* (11) mount options */ "%*[^\n]", /* some rubbish at the end */ - &path); - if (k != 1) { + &path, &options); + if (k != 2) { if (k == EOF) break; @@ -129,6 +131,9 @@ static int mount_points_list_get(MountPoint **head) { } m->path = p; + m->options = options; + options = NULL; + LIST_PREPEND(mount_point, *head, m); } @@ -373,6 +378,14 @@ static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_e benefits, but might confuse the host, as we remount the superblock here, not the bind mound. */ if (detect_container() <= 0) { + _cleanup_free_ char *options = NULL; + /* MS_REMOUNT requires that the data parameter + * should be the same from the original mount + * except for the desired changes. Since we want + * to remount read-only, we should filter out + * rw (and ro too, because it confuses the kernel) */ + (void) fstab_filter_options(m->options, "rw\0ro\0", NULL, NULL, &options); + /* We always try to remount directories * read-only first, before we go on and umount * them. @@ -389,7 +402,8 @@ static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_e * alias read-only we hence should be * relatively safe regarding keeping the fs we * can otherwise not see dirty. */ - (void) mount(NULL, m->path, NULL, MS_REMOUNT|MS_RDONLY, NULL); + log_info("Remounting '%s' read-only with options '%s'.", m->path, options); + (void) mount(NULL, m->path, NULL, MS_REMOUNT|MS_RDONLY, options); } /* Skip / and /usr since we cannot unmount that diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c index 5b62f2d65c..4a5c7efdb0 100644 --- a/src/core/unit-printf.c +++ b/src/core/unit-printf.c @@ -26,8 +26,9 @@ #include "string-util.h" #include "strv.h" #include "unit-name.h" -#include "unit.h" #include "unit-printf.h" +#include "unit.h" +#include "user-util.h" static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) { Unit *u = userdata; diff --git a/src/core/unit.c b/src/core/unit.c index a054cc79b0..572b1c1b78 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -51,8 +51,9 @@ #include "string-util.h" #include "strv.h" #include "unit-name.h" -#include "virt.h" #include "unit.h" +#include "user-util.h" +#include "virt.h" const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = { [UNIT_SERVICE] = &service_vtable, |