Systemd/src/shared
Lennart Poettering e5b4220341 shared: rework switch_root() code
Let's follow symlinks before invoking mount() on arbitrary paths, so that we
won't get confused if directories are prepared with absolute symlinks.

Use FOREACH_STRING() instead of NULSTR_FOREACH() as it is more readable.

Don't use snprintf() for concatenating strings, let chase_symlinks() to that.

Replace homegrown mount check with path_is_mount_point(). Also, change the
behaviour when we encounter this: instead of unmounting the old mount point,
simply leave it around and don't replace it, so that initrds can mount stuff
there with different settings than we would apply. This is in-line with how we
handle automatic mounts in nspawn for example.

Use umount_recursive() instead of a simple umount2() for unmounting the old
root, so that we actually cover really all mounts, not just the top-level one.
2016-12-21 19:09:29 +01:00
..
linux
acl-util.c acl-util: fix memleak 2016-11-03 22:07:49 +00:00
acl-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
acpi-fpdt.c shared/acpi-fpdt: use ENODATA for missing data and skip test 2016-03-04 21:45:45 -05:00
acpi-fpdt.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
apparmor-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
apparmor-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
ask-password-api.c Rename formats-util.h to format-util.h 2016-11-07 10:15:08 -05:00
ask-password-api.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
base-filesystem.c shared: use uid_is_valid() for checking validity of UIDs 2016-12-20 20:00:08 +01:00
base-filesystem.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
boot-timestamps.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
boot-timestamps.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
bus-unit-util.c Modify mount_propagation_flags_from_string to return a normal int code 2016-12-17 13:57:04 -05:00
bus-unit-util.h bus-util: unify loop around bus_append_unit_property_assignment() 2016-08-18 22:23:31 +02:00
bus-util.c shared: split out code for adding multiple names to sd_bus_track object 2016-11-16 15:03:26 +01:00
bus-util.h shared: split out code for adding multiple names to sd_bus_track object 2016-11-16 15:03:26 +01:00
cgroup-show.c Rename formats-util.h to format-util.h 2016-11-07 10:15:08 -05:00
cgroup-show.h shared: drop kernel_thread bool from cgroups show code 2016-04-22 16:06:20 +02:00
clean-ipc.c Rename formats-util.h to format-util.h 2016-11-07 10:15:08 -05:00
clean-ipc.h core: add RemoveIPC= setting 2016-08-19 00:37:25 +02:00
condition.c tree-wide: stop using canonicalize_file_name(), use chase_symlinks() instead 2016-12-01 00:25:51 +01:00
condition.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
conf-parser.c tree-wide: drop unneded WHITESPACE param to extract_first_word 2016-11-05 15:35:51 -04:00
conf-parser.h shared/conf-parser: add config_parse_many which takes strv with dirs 2016-09-16 10:32:03 -04:00
dev-setup.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
dev-setup.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
dissect-image.c dissect: optionally, only look for GPT partition tables, nothing else 2016-12-20 20:00:09 +01:00
dissect-image.h dissect: optionally, only look for GPT partition tables, nothing else 2016-12-20 20:00:09 +01:00
dns-domain.c shared: add new API to validate a string as hostname or IP address 2016-11-21 22:58:26 +01:00
dns-domain.h shared: add new API to validate a string as hostname or IP address 2016-11-21 22:58:26 +01:00
dropin.c tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853) 2016-12-09 10:04:30 +01:00
dropin.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
efivars.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
efivars.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fdset.c tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853) 2016-12-09 10:04:30 +01:00
fdset.h build-sys: move fdset.[ch] src/basic → src/shared (#3580) 2016-06-23 05:10:53 +03:00
firewall-util.c shared/firewall-util: remove warning about net/if.h workaround 2016-12-10 13:55:13 -05:00
firewall-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fstab-util.c tree-wide: always invoke setmntent() with "re" mode 2016-12-20 20:00:09 +01:00
fstab-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
gcrypt-util.c build-sys: fix build with libgrcypt disabled 2016-03-27 21:51:44 -04:00
gcrypt-util.h systemd-resolve: use sha256 for local-part of openpgp key (#4193) 2016-10-08 13:59:34 +02:00
generator.c generator: order fsck service After= the device 2016-12-14 10:13:52 +01:00
generator.h Create initrd-root-device.target synchronization point (#3239) 2016-05-12 18:42:39 +02:00
gpt.h nspawn/dissect: automatically discover dm-verity verity partitions 2016-12-07 18:38:41 +01:00
ima-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
ima-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
import-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
import-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
initreq.h
install-printf.c Rename formats-util.h to format-util.h 2016-11-07 10:15:08 -05:00
install-printf.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
install.c Merge pull request #4510 from keszybz/tree-wide-cleanups 2016-11-03 13:59:20 -06:00
install.h shared, systemctl: teach is-enabled to show installation targets 2016-10-24 10:19:08 +02:00
logs-show.c tree-wide: add PRI_[NU]SEC, and use time format strings more 2016-11-07 22:49:09 -05:00
logs-show.h shared: move output_mode_to_string() into output-mode.c 2016-04-22 16:16:59 +02:00
loop-util.c dissect: add small "systemd-dissect" tool as wrapper around dissect-image.c 2016-12-07 18:38:41 +01:00
loop-util.h dissect: add small "systemd-dissect" tool as wrapper around dissect-image.c 2016-12-07 18:38:41 +01:00
machine-image.c nspawn: add fallback top normal copy/reflink when we cannot btrfs snapshot 2016-11-22 13:35:09 +01:00
machine-image.h machinectl: add new "machinectl clean" command 2016-04-12 13:43:33 +02:00
machine-pool.c tree-wide: stop using canonicalize_file_name(), use chase_symlinks() instead 2016-12-01 00:25:51 +01:00
machine-pool.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
Makefile build-sys: add missing Makefile symlink 2015-08-31 13:09:52 +02:00
nsflags.c Merge pull request #4538 from fbuihuu/confirm-spawn-fixes 2016-11-18 11:08:06 +01:00
nsflags.h core: add new RestrictNamespaces= unit file setting 2016-11-04 07:40:13 -06:00
output-mode.c journalctl: add new output mode "short-full" (#3880) 2016-08-03 19:45:07 -04:00
output-mode.h journalctl: add new output mode "short-full" (#3880) 2016-08-03 19:45:07 -04:00
pager.c pager: tiny beautification 2016-10-11 17:46:59 +02:00
pager.h tree-wide: merge pager_open_if_enabled() to the pager_open() 2016-02-26 01:13:23 +06:00
path-lookup.c tree-wide: drop NULL sentinel from strjoin 2016-10-23 11:43:27 -04:00
path-lookup.h systemctl: don't confuse sysv code with generated units 2016-04-12 13:43:32 +02:00
ptyfwd.c tree-wide: use mfree more 2016-10-16 23:35:39 -04:00
ptyfwd.h run: optionally, wait for the service to finish and show its result 2016-08-22 16:14:21 +02:00
resolve-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
resolve-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
seccomp-util.c seccomp: add @filesystem syscall group (#4537) 2016-11-21 19:29:12 -05:00
seccomp-util.h seccomp: add @filesystem syscall group (#4537) 2016-11-21 19:29:12 -05:00
sleep-config.c tree-wide: rename config_parse_many to …_nulstr 2016-09-16 10:32:03 -04:00
sleep-config.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
spawn-ask-password-agent.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
spawn-ask-password-agent.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
spawn-polkit-agent.c polkit: don't start polkit agent when running as root 2016-04-05 12:18:55 +02:00
spawn-polkit-agent.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
specifier.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
specifier.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
switch-root.c shared: rework switch_root() code 2016-12-21 19:09:29 +01:00
switch-root.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
sysctl-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
sysctl-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
test-tables.h test-tables: ellide boring parts of sparse mappings 2016-01-29 12:13:08 -05:00
tests.c tests: override XDG_RUNTIME_DIR where we use the user runtime dir 2016-04-12 13:43:33 +02:00
tests.h tests: override XDG_RUNTIME_DIR where we use the user runtime dir 2016-04-12 13:43:33 +02:00
udev-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
uid-range.c tree-wide: make ++/-- usage consistent WRT spacing 2016-02-22 20:32:04 -08:00
uid-range.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
utmp-wtmp.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
utmp-wtmp.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
vlan-util.c networkd: clean up vlan handling a bit (#3478) 2016-06-09 18:55:16 +02:00
vlan-util.h networkd: clean up vlan handling a bit (#3478) 2016-06-09 18:55:16 +02:00
volatile-util.c nspawn: split out VolatileMode definitions 2016-12-20 20:00:08 +01:00
volatile-util.h nspawn: split out VolatileMode definitions 2016-12-20 20:00:08 +01:00
watchdog.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
watchdog.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00