diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-10-20 23:27:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-10-25 10:41:26 +0200 |
commit | 0289948eb4b22c01fe27e708056e6daaa719b9ae (patch) | |
tree | 16b54485ec62efb94c8858fd5b360ec158c2e732 /src/shared/mount-util.h | |
parent | 874052c5014e774a9c9ca86149c724a7440d7094 (diff) | |
download | systemd-0289948eb4b22c01fe27e708056e6daaa719b9ae.tar.gz |
mount-util: move opening of /proc/self/mountinfo into bind_remount_one_with_mountinfo()
Let's move things around a bit, and open /proc/self/mountinfo if needed
inside of bind_remount_one_with_mountinfo(). That way bind_remount_one()
can become a superthin inline wrapper around
bind_remount_one_with_mountinfo(). Main benefit is that we don't even
have to open /p/s/mi in case mount_setattr() actually worked for us.
Diffstat (limited to 'src/shared/mount-util.h')
-rw-r--r-- | src/shared/mount-util.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/mount-util.h b/src/shared/mount-util.h index 36501c2c4a..d9fb801e61 100644 --- a/src/shared/mount-util.h +++ b/src/shared/mount-util.h @@ -40,8 +40,12 @@ int mount_nofollow(const char *source, const char *target, const char *filesyste int repeat_unmount(const char *path, int flags); int umount_recursive(const char *target, int flags); -int bind_remount_recursive(const char *prefix, unsigned long new_flags, unsigned long flags_mask, char **deny_list); + int bind_remount_recursive_with_mountinfo(const char *prefix, unsigned long new_flags, unsigned long flags_mask, char **deny_list, FILE *proc_self_mountinfo); +static inline int bind_remount_recursive(const char *prefix, unsigned long new_flags, unsigned long flags_mask, char **deny_list) { + return bind_remount_recursive_with_mountinfo(prefix, new_flags, flags_mask, deny_list, NULL); +} + int bind_remount_one_with_mountinfo(const char *path, unsigned long new_flags, unsigned long flags_mask, FILE *proc_self_mountinfo); int mount_move_root(const char *path); |