From 58172968ad2f9a350172f062cc459d070569916d Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Thu, 27 Apr 2017 11:50:26 +0200 Subject: [PATCH] Prep v229: Add missing fixes from upstream [2/6] src/core --- src/core/cgroup.h | 37 +++++-------------------------------- src/core/mount-setup.c | 34 ++++++++++++++-------------------- 2 files changed, 19 insertions(+), 52 deletions(-) diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 1957f2d83..2a5a223eb 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -21,21 +21,11 @@ #include -// #include "list.h" -// #include "time-util.h" +//#include "list.h" #include "logind.h" +//#include "time-util.h" #if 0 /// UNNEEDED by elogind -typedef struct CGroupContext CGroupContext; -Stypedef struct CGroupDeviceAllow CGroupDeviceAllow; -typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; -typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; - -/* Maximum value for fixed (manual) net class ID assignment, - * and also the value at which the range of automatic assignments starts - */ -#define CGROUP_NETCLASS_FIXED_MAX UINT32_C(65535) - typedef struct CGroupContext CGroupContext; typedef struct CGroupDeviceAllow CGroupDeviceAllow; typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; @@ -57,17 +47,6 @@ typedef enum CGroupDevicePolicy { _CGROUP_DEVICE_POLICY_INVALID = -1 } CGroupDevicePolicy; -typedef enum CGroupNetClassType { - /* Default - do not assign a net class */ - CGROUP_NETCLASS_TYPE_NONE, - - /* Automatically assign a net class */ - CGROUP_NETCLASS_TYPE_AUTO, - - /* Assign the net class that was provided by the user */ - CGROUP_NETCLASS_TYPE_FIXED, -} CGroupNetClassType; - struct CGroupDeviceAllow { LIST_FIELDS(CGroupDeviceAllow, device_allow); char *path; @@ -109,9 +88,6 @@ struct CGroupContext { CGroupDevicePolicy device_policy; LIST_HEAD(CGroupDeviceAllow, device_allow); - CGroupNetClassType netclass_type; - uint32_t netclass_id; - uint64_t tasks_max; bool delegate; @@ -123,7 +99,7 @@ struct CGroupContext { void cgroup_context_init(CGroupContext *c); void cgroup_context_done(CGroupContext *c); void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix); -void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, uint32_t netclass_id, ManagerState state); +void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, ManagerState state); CGroupMask cgroup_context_get_mask(CGroupContext *c); @@ -136,12 +112,12 @@ CGroupMask unit_get_siblings_mask(Unit *u); CGroupMask unit_get_members_mask(Unit *u); CGroupMask unit_get_subtree_mask(Unit *u); -vCGroupMask unit_get_target_mask(Unit *u); +CGroupMask unit_get_target_mask(Unit *u); CGroupMask unit_get_enable_mask(Unit *u); void unit_update_cgroup_members_masks(Unit *u); -har *unit_default_cgroup_path(Unit *u); +char *unit_default_cgroup_path(Unit *u); int unit_set_cgroup_path(Unit *u, const char *path); int unit_realize_cgroup(Unit *u); @@ -151,10 +127,7 @@ int unit_watch_cgroup(Unit *u); int unit_attach_pids_to_cgroup(Unit *u); -int unit_add_to_netclass_cgroup(Unit *u); -int unit_remove_from_netclass_cgroup(Unit *u); #endif // 0 - int manager_setup_cgroup(Manager *m); void manager_shutdown_cgroup(Manager *m, bool delete); diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c index f48d8a0ab..0467fe210 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -40,8 +38,8 @@ #include "path-util.h" //#include "set.h" //#include "smack-util.h" -//#include "strv.h" #include "string-util.h" +//#include "strv.h" #include "user-util.h" //#include "util.h" #include "virt.h" @@ -215,19 +213,14 @@ static int mount_one(const MountPoint *p, bool relabel) { return 1; } -#if 0 /// UNNEEDED by elogind -int mount_setup_early(void) { +static int mount_points_setup(unsigned n, bool loaded_policy) { unsigned i; int r = 0; - assert_cc(N_EARLY_MOUNT <= ELEMENTSOF(mount_table)); - - /* Do a minimal mount of /proc and friends to enable the most - * basic stuff, such as SELinux */ - for (i = 0; i < N_EARLY_MOUNT; i ++) { + for (i = 0; i < n; i ++) { int j; - j = mount_one(mount_table + i, false); + j = mount_one(mount_table + i, loaded_policy); if (j != 0 && r >= 0) r = j; } @@ -235,6 +228,15 @@ int mount_setup_early(void) { return r; } +#if 0 /// UNNEEDED by elogind +int mount_setup_early(void) { + assert_cc(N_EARLY_MOUNT <= ELEMENTSOF(mount_table)); + + /* Do a minimal mount of /proc and friends to enable the most + * basic stuff, such as SELinux */ + return mount_points_setup(N_EARLY_MOUNT, false); +} + int mount_cgroup_controllers(char ***join_controllers) { _cleanup_set_free_free_ Set *controllers = NULL; int r; @@ -370,21 +372,13 @@ static int nftw_cb( #endif // 0 int mount_setup(bool loaded_policy) { - unsigned i; int r = 0; - for (i = 0; i < ELEMENTSOF(mount_table); i ++) { - int j; - - j = mount_one(mount_table + i, loaded_policy); - if (j != 0 && r >= 0) - r = j; - } + r = mount_points_setup(ELEMENTSOF(mount_table), loaded_policy); if (r < 0) return r; - #if 0 /// elogind does not control /, /dev, /run and /run/systemd/* are setup elsewhere. #if defined(HAVE_SELINUX) || defined(HAVE_SMACK) /* Nodes in devtmpfs and /run need to be manually updated for -- 2.30.2