diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2018-07-23 21:17:03 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-08-16 21:55:16 -0400 |
commit | a45e2e003b04b3f1d0fb56d95adcede3eb0e9d24 (patch) | |
tree | 4b03af315f5f30eb60366ab9677638f523d2d398 | |
parent | 7af63c28fc2a788174471aa189fc31d4cd650d38 (diff) |
nspawn: nspawn.c: s/unified_cgroup_hierarchy/inner_cgver/
-rw-r--r-- | src/nspawn/nspawn.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 4a2c64ed86..454df8693d 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -182,7 +182,7 @@ static UserNamespaceMode arg_userns_mode = USER_NAMESPACE_NO; static uid_t arg_uid_shift = UID_INVALID, arg_uid_range = 0x10000U; static bool arg_userns_chown = false; static int arg_kill_signal = 0; -static CGroupUnified arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_UNKNOWN; +static CGroupUnified arg_inner_cgver = CGROUP_UNIFIED_UNKNOWN; static SettingsMask arg_settings_mask = 0; static int arg_settings_trusted = -1; static char **arg_parameters = NULL; @@ -323,7 +323,7 @@ static int custom_mount_check_all(void) { return 0; } -static int detect_unified_cgroup_hierarchy_from_environment(void) { +static int detect_inner_cgver_from_environment(void) { const char *e; int r; @@ -334,15 +334,15 @@ static int detect_unified_cgroup_hierarchy_from_environment(void) { if (r < 0) return log_error_errno(r, "Failed to parse $UNIFIED_CGROUP_HIERARCHY."); if (r > 0) - arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_ALL; + arg_inner_cgver = CGROUP_UNIFIED_ALL; else - arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_NONE; + arg_inner_cgver = CGROUP_UNIFIED_NONE; } return 0; } -static int detect_unified_cgroup_hierarchy_from_image(const char *directory) { +static int detect_inner_cgver_from_image(const char *directory) { int r; /* Let's inherit the mode to use from the host system, but let's take into consideration what systemd in the @@ -357,24 +357,24 @@ static int detect_unified_cgroup_hierarchy_from_image(const char *directory) { if (r < 0) return log_error_errno(r, "Failed to determine systemd version in container: %m"); if (r > 0) - arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_ALL; + arg_inner_cgver = CGROUP_UNIFIED_ALL; else - arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_NONE; + arg_inner_cgver = CGROUP_UNIFIED_NONE; } else if (cg_unified_controller(SYSTEMD_CGROUP_CONTROLLER) > 0) { /* Mixed cgroup hierarchy support was added in 233 */ r = systemd_installation_has_version(directory, 233); if (r < 0) return log_error_errno(r, "Failed to determine systemd version in container: %m"); if (r > 0) - arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_SYSTEMD; + arg_inner_cgver = CGROUP_UNIFIED_SYSTEMD; else - arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_NONE; + arg_inner_cgver = CGROUP_UNIFIED_NONE; } else - arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_NONE; + arg_inner_cgver = CGROUP_UNIFIED_NONE; log_debug("Using %s hierarchy for container.", - arg_unified_cgroup_hierarchy == CGROUP_UNIFIED_NONE ? "legacy" : - arg_unified_cgroup_hierarchy == CGROUP_UNIFIED_SYSTEMD ? "hybrid" : "unified"); + arg_inner_cgver == CGROUP_UNIFIED_NONE ? "legacy" : + arg_inner_cgver == CGROUP_UNIFIED_SYSTEMD ? "hybrid" : "unified"); return 0; } @@ -2588,7 +2588,7 @@ static int inner_child( return log_error_errno(errno, "Failed to unshare cgroup namespace: %m"); r = mount_cgroups( "", - arg_unified_cgroup_hierarchy, + arg_inner_cgver, arg_userns_mode != USER_NAMESPACE_NO, arg_uid_shift, arg_uid_range, @@ -2597,7 +2597,7 @@ static int inner_child( if (r < 0) return r; } else { - r = mount_systemd_cgroup_writable("", arg_unified_cgroup_hierarchy); + r = mount_systemd_cgroup_writable("", arg_inner_cgver); if (r < 0) return r; } @@ -2811,7 +2811,7 @@ static int outer_child( int kmsg_socket, int rtnl_socket, int uid_shift_socket, - int unified_cgroup_hierarchy_socket, + int inner_cgver_socket, FDSet *fds, int netns_fd) { @@ -2912,22 +2912,22 @@ static int outer_child( return r; } - if (arg_unified_cgroup_hierarchy == CGROUP_UNIFIED_UNKNOWN) { + if (arg_inner_cgver == CGROUP_UNIFIED_UNKNOWN) { /* OK, we don't know yet which cgroup mode to use yet. Let's figure it out, and tell the parent. */ - r = detect_unified_cgroup_hierarchy_from_image(directory); + r = detect_inner_cgver_from_image(directory); if (r < 0) return r; - l = send(unified_cgroup_hierarchy_socket, &arg_unified_cgroup_hierarchy, sizeof(arg_unified_cgroup_hierarchy), MSG_NOSIGNAL); + l = send(inner_cgver_socket, &arg_inner_cgver, sizeof(arg_inner_cgver), MSG_NOSIGNAL); if (l < 0) return log_error_errno(errno, "Failed to send cgroup mode: %m"); - if (l != sizeof(arg_unified_cgroup_hierarchy)) { + if (l != sizeof(arg_inner_cgver)) { log_error("Short write while sending cgroup mode."); return -EIO; } - unified_cgroup_hierarchy_socket = safe_close(unified_cgroup_hierarchy_socket); + inner_cgver_socket = safe_close(inner_cgver_socket); } /* Turn directory into bind mount */ @@ -3049,7 +3049,7 @@ static int outer_child( if (!arg_use_cgns || !cg_ns_supported()) { r = mount_cgroups( directory, - arg_unified_cgroup_hierarchy, + arg_inner_cgver, arg_userns_mode != USER_NAMESPACE_NO, arg_uid_shift, arg_uid_range, @@ -3624,7 +3624,7 @@ static int run(int master, uuid_socket_pair[2] = { -1, -1 }, notify_socket_pair[2] = { -1, -1 }, uid_shift_socket_pair[2] = { -1, -1 }, - unified_cgroup_hierarchy_socket_pair[2] = { -1, -1}; + inner_cgver_socket_pair[2] = { -1, -1}; _cleanup_close_ int notify_socket= -1; _cleanup_(barrier_destroy) Barrier barrier = BARRIER_NULL; @@ -3679,8 +3679,8 @@ static int run(int master, if (socketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CLOEXEC, 0, uid_shift_socket_pair) < 0) return log_error_errno(errno, "Failed to create uid shift socket pair: %m"); - if (arg_unified_cgroup_hierarchy == CGROUP_UNIFIED_UNKNOWN) - if (socketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CLOEXEC, 0, unified_cgroup_hierarchy_socket_pair) < 0) + if (arg_inner_cgver == CGROUP_UNIFIED_UNKNOWN) + if (socketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CLOEXEC, 0, inner_cgver_socket_pair) < 0) return log_error_errno(errno, "Failed to create unified cgroup socket pair: %m"); /* Child can be killed before execv(), so handle SIGCHLD in order to interrupt @@ -3725,7 +3725,7 @@ static int run(int master, uuid_socket_pair[0] = safe_close(uuid_socket_pair[0]); notify_socket_pair[0] = safe_close(notify_socket_pair[0]); uid_shift_socket_pair[0] = safe_close(uid_shift_socket_pair[0]); - unified_cgroup_hierarchy_socket_pair[0] = safe_close(unified_cgroup_hierarchy_socket_pair[0]); + inner_cgver_socket_pair[0] = safe_close(inner_cgver_socket_pair[0]); (void) reset_all_signal_handlers(); (void) reset_signal_mask(); @@ -3742,7 +3742,7 @@ static int run(int master, kmsg_socket_pair[1], rtnl_socket_pair[1], uid_shift_socket_pair[1], - unified_cgroup_hierarchy_socket_pair[1], + inner_cgver_socket_pair[1], fds, netns_fd); if (r < 0) @@ -3761,7 +3761,7 @@ static int run(int master, uuid_socket_pair[1] = safe_close(uuid_socket_pair[1]); notify_socket_pair[1] = safe_close(notify_socket_pair[1]); uid_shift_socket_pair[1] = safe_close(uid_shift_socket_pair[1]); - unified_cgroup_hierarchy_socket_pair[1] = safe_close(unified_cgroup_hierarchy_socket_pair[1]); + inner_cgver_socket_pair[1] = safe_close(inner_cgver_socket_pair[1]); if (arg_userns_mode != USER_NAMESPACE_NO) { /* The child just let us know the UID shift it might have read from the image. */ @@ -3792,12 +3792,12 @@ static int run(int master, } } - if (arg_unified_cgroup_hierarchy == CGROUP_UNIFIED_UNKNOWN) { + if (arg_inner_cgver == CGROUP_UNIFIED_UNKNOWN) { /* The child let us know the support cgroup mode it might have read from the image. */ - l = recv(unified_cgroup_hierarchy_socket_pair[0], &arg_unified_cgroup_hierarchy, sizeof(arg_unified_cgroup_hierarchy), 0); + l = recv(inner_cgver_socket_pair[0], &arg_inner_cgver, sizeof(arg_inner_cgver), 0); if (l < 0) return log_error_errno(errno, "Failed to read cgroup mode: %m"); - if (l != sizeof(arg_unified_cgroup_hierarchy)) { + if (l != sizeof(arg_inner_cgver)) { log_error("Short read while reading cgroup mode."); return -EIO; } @@ -3961,15 +3961,15 @@ static int run(int master, } else if (arg_slice || arg_property) log_notice("Machine and scope registration turned off, --slice= and --property= settings will have no effect."); - r = sync_cgroup(*pid, arg_unified_cgroup_hierarchy, arg_uid_shift); + r = sync_cgroup(*pid, arg_inner_cgver, arg_uid_shift); if (r < 0) return r; - r = create_subcgroup(*pid, arg_keep_unit, arg_unified_cgroup_hierarchy); + r = create_subcgroup(*pid, arg_keep_unit, arg_inner_cgver); if (r < 0) return r; - r = chown_cgroup(*pid, arg_unified_cgroup_hierarchy, arg_uid_shift); + r = chown_cgroup(*pid, arg_inner_cgver, arg_uid_shift); if (r < 0) return r; @@ -4215,7 +4215,7 @@ int main(int argc, char *argv[]) { if (r < 0) goto finish; - r = detect_unified_cgroup_hierarchy_from_environment(); + r = detect_inner_cgver_from_environment(); if (r < 0) goto finish; |