summaryrefslogtreecommitdiff
path: root/src/core/unit.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-06-17 21:33:26 +0200
committerLennart Poettering <lennart@poettering.net>2013-06-17 21:36:51 +0200
commita016b9228f338cb9b380ce7e00826ef462767d98 (patch)
tree515b85e7fb384bc186374067554baf233897a9d3 /src/core/unit.h
parentc647f10918940b5d11870df6d008c6c3180bdc41 (diff)
core: add new .slice unit type for partitioning systems
In order to prepare for the kernel cgroup rework, let's introduce a new unit type to systemd, the "slice". Slices can be arranged in a tree and are useful to partition resources freely and hierarchally by the user. Each service unit can now be assigned to one of these slices, and later on login users and machines may too. Slices translate pretty directly to the cgroup hierarchy, and the various objects can be assigned to any of the slices in the tree.
Diffstat (limited to 'src/core/unit.h')
-rw-r--r--src/core/unit.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/core/unit.h b/src/core/unit.h
index b04475e4fb..81b8adbfdc 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -118,6 +118,15 @@ enum UnitDependency {
#include "cgroup.h"
#include "cgroup-attr.h"
+struct UnitRef {
+ /* Keeps tracks of references to a unit. This is useful so
+ * that we can merge two units if necessary and correct all
+ * references to them */
+
+ Unit* unit;
+ LIST_FIELDS(UnitRef, refs);
+};
+
struct Unit {
Manager *manager;
@@ -168,6 +177,8 @@ struct Unit {
CGroupBonding *cgroup_bondings;
CGroupAttribute *cgroup_attributes;
+ UnitRef slice;
+
/* Per type list */
LIST_FIELDS(Unit, units_by_type);
@@ -240,15 +251,6 @@ struct Unit {
bool in_audit:1;
};
-struct UnitRef {
- /* Keeps tracks of references to a unit. This is useful so
- * that we can merge two units if necessary and correct all
- * references to them */
-
- Unit* unit;
- LIST_FIELDS(UnitRef, refs);
-};
-
struct UnitStatusMessageFormats {
const char *starting_stopping[2];
const char *finished_start_job[_JOB_RESULT_MAX];
@@ -265,6 +267,7 @@ struct UnitStatusMessageFormats {
#include "snapshot.h"
#include "swap.h"
#include "path.h"
+#include "slice.h"
struct UnitVTable {
/* How much memory does an object of this unit type need */
@@ -433,6 +436,7 @@ DEFINE_CAST(AUTOMOUNT, Automount);
DEFINE_CAST(SNAPSHOT, Snapshot);
DEFINE_CAST(SWAP, Swap);
DEFINE_CAST(PATH, Path);
+DEFINE_CAST(SLICE, Slice);
Unit *unit_new(Manager *m, size_t size);
void unit_free(Unit *u);
@@ -474,6 +478,8 @@ int unit_load_fragment_and_dropin(Unit *u);
int unit_load_fragment_and_dropin_optional(Unit *u);
int unit_load(Unit *unit);
+int unit_add_default_slice(Unit *u);
+
const char *unit_description(Unit *u) _pure_;
bool unit_has_name(Unit *u, const char *name);