Skip to content

Commit fdb3dec

Browse files
committed
util-lib: move some functions from basic/cgroup-util to shared/cgroup-setup
This way less stuff needs to be in basic. Initially, I wanted to move all the parts of cgroup-utils.[ch] that depend on efivars.[ch] to shared, because efivars.[ch] is in shared/. Later on, I decide to split efivars.[ch], so the move done in this patch is not necessary anymore. Nevertheless, it is still valid on its own. If at some point we want to expose libbasic, it is better to to not have stuff that belong in libshared there.
1 parent 55fced5 commit fdb3dec

19 files changed

+978
-927
lines changed

src/basic/cgroup-util.c

Lines changed: 0 additions & 846 deletions
Large diffs are not rendered by default.

src/basic/cgroup-util.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ typedef int (*cg_kill_log_func_t)(pid_t pid, int sig, void *userdata);
172172
int cg_kill(const char *controller, const char *path, int sig, CGroupFlags flags, Set *s, cg_kill_log_func_t kill_log, void *userdata);
173173
int cg_kill_recursive(const char *controller, const char *path, int sig, CGroupFlags flags, Set *s, cg_kill_log_func_t kill_log, void *userdata);
174174

175-
int cg_migrate(const char *cfrom, const char *pfrom, const char *cto, const char *pto, CGroupFlags flags);
176-
int cg_migrate_recursive(const char *cfrom, const char *pfrom, const char *cto, const char *pto, CGroupFlags flags);
177-
int cg_migrate_recursive_fallback(const char *cfrom, const char *pfrom, const char *cto, const char *pto, CGroupFlags flags);
178-
179175
int cg_split_spec(const char *spec, char **controller, char **path);
180176
int cg_mangle_path(const char *path, char **result);
181177

@@ -184,15 +180,8 @@ int cg_get_path_and_check(const char *controller, const char *path, const char *
184180

185181
int cg_pid_get_path(const char *controller, pid_t pid, char **path);
186182

187-
int cg_trim(const char *controller, const char *path, bool delete_root);
188-
189183
int cg_rmdir(const char *controller, const char *path);
190184

191-
int cg_create(const char *controller, const char *path);
192-
int cg_attach(const char *controller, const char *path, pid_t pid);
193-
int cg_attach_fallback(const char *controller, const char *path, pid_t pid);
194-
int cg_create_and_attach(const char *controller, const char *path, pid_t pid);
195-
196185
int cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *value);
197186
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret);
198187
int cg_get_keyed_attribute(const char *controller, const char *path, const char *attribute, char **keys, char **values);
@@ -240,13 +229,6 @@ int cg_slice_to_path(const char *unit, char **ret);
240229

241230
typedef const char* (*cg_migrate_callback_t)(CGroupMask mask, void *userdata);
242231

243-
int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path);
244-
int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata);
245-
int cg_attach_many_everywhere(CGroupMask supported, const char *path, Set* pids, cg_migrate_callback_t callback, void *userdata);
246-
int cg_migrate_everywhere(CGroupMask supported, const char *from, const char *to, cg_migrate_callback_t callback, void *userdata);
247-
int cg_trim_everywhere(CGroupMask supported, const char *path, bool delete_root);
248-
int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p, CGroupMask *ret_result_mask);
249-
250232
int cg_mask_supported(CGroupMask *ret);
251233
int cg_mask_from_string(const char *s, CGroupMask *ret);
252234
int cg_mask_to_string(CGroupMask mask, char **ret);
@@ -263,16 +245,8 @@ static inline int cg_unified(void) {
263245
return cg_unified_cached(true);
264246
}
265247

266-
bool cg_is_unified_wanted(void);
267-
bool cg_is_legacy_wanted(void);
268-
bool cg_is_hybrid_wanted(void);
269-
270248
const char* cgroup_controller_to_string(CGroupController c) _const_;
271249
CGroupController cgroup_controller_from_string(const char *s) _pure_;
272250

273-
int cg_weight_parse(const char *s, uint64_t *ret);
274-
int cg_cpu_shares_parse(const char *s, uint64_t *ret);
275-
int cg_blkio_weight_parse(const char *s, uint64_t *ret);
276-
277251
bool is_cgroup_fs(const struct statfs *s);
278252
bool fd_is_cgroup_fs(int fd);

src/core/cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "bpf-firewall.h"
1212
#include "btrfs-util.h"
1313
#include "bus-error.h"
14+
#include "cgroup-setup.h"
1415
#include "cgroup-util.h"
1516
#include "cgroup.h"
1617
#include "fd-util.h"

src/core/execute.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "cap-list.h"
4949
#include "capability-util.h"
5050
#include "chown-recursive.h"
51+
#include "cgroup-setup.h"
5152
#include "cpu-set-util.h"
5253
#include "def.h"
5354
#include "env-file.h"

src/core/load-fragment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "bus-util.h"
2525
#include "cap-list.h"
2626
#include "capability-util.h"
27-
#include "cgroup.h"
27+
#include "cgroup-setup.h"
2828
#include "conf-parser.h"
2929
#include "cpu-set-util.h"
3030
#include "env-util.h"

src/core/mount-setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "bus-util.h"
1212
#include "cgroup-util.h"
1313
#include "conf-files.h"
14+
#include "cgroup-setup.h"
1415
#include "dev-setup.h"
1516
#include "efivars.h"
1617
#include "fd-util.h"

src/core/unit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "bpf-firewall.h"
1616
#include "bus-common-errors.h"
1717
#include "bus-util.h"
18+
#include "cgroup-setup.h"
1819
#include "cgroup-util.h"
1920
#include "dbus-unit.h"
2021
#include "dbus.h"

src/login/pam_systemd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "bus-error.h"
2121
#include "bus-internal.h"
2222
#include "bus-util.h"
23-
#include "cgroup-util.h"
23+
#include "cgroup-setup.h"
2424
#include "errno-util.h"
2525
#include "fd-util.h"
2626
#include "fileio.h"

src/nspawn/nspawn-cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <sys/mount.h>
44

55
#include "alloc-util.h"
6+
#include "cgroup-setup.h"
67
#include "fd-util.h"
78
#include "fileio.h"
89
#include "format-util.h"

src/shared/bus-unit-util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "bus-unit-util.h"
66
#include "bus-util.h"
77
#include "cap-list.h"
8+
#include "cgroup-setup.h"
89
#include "cgroup-util.h"
910
#include "condition.h"
1011
#include "cpu-set-util.h"

0 commit comments

Comments
 (0)