diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-06-17 21:33:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-06-17 21:36:51 +0200 |
commit | a016b9228f338cb9b380ce7e00826ef462767d98 (patch) | |
tree | 515b85e7fb384bc186374067554baf233897a9d3 /src/core/slice.h | |
parent | c647f10918940b5d11870df6d008c6c3180bdc41 (diff) | |
download | systemd-a016b9228f338cb9b380ce7e00826ef462767d98.tar.gz |
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/slice.h')
-rw-r--r-- | src/core/slice.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/core/slice.h b/src/core/slice.h new file mode 100644 index 0000000000..4320a6354b --- /dev/null +++ b/src/core/slice.h @@ -0,0 +1,44 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2013 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +typedef struct Slice Slice; + +#include "unit.h" + +typedef enum SliceState { + SLICE_DEAD, + SLICE_ACTIVE, + _SLICE_STATE_MAX, + _SLICE_STATE_INVALID = -1 +} SliceState; + +struct Slice { + Unit meta; + + SliceState state, deserialized_state; +}; + +extern const UnitVTable slice_vtable; + +const char* slice_state_to_string(SliceState i) _const_; +SliceState slice_state_from_string(const char *s) _pure_; |