summaryrefslogtreecommitdiff
path: root/src/core/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-16 20:59:31 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-16 20:59:31 +0200
commit5ee50f525f79169cb984813620ca7df144f82132 (patch)
treea19549c73fc3d748772ee697ce3f0826f791f4e1 /src/core/load-fragment.c
parent7ed1f63d506f8023db57e496519c7ef63820762e (diff)
parent32ee7d3309816994a02b3ff000e9734120d71214 (diff)
Merge pull request #1269 from zonque/netcls
cgroup: add support for net_cls controllers
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r--src/core/load-fragment.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index b476d472b3..1217b4651e 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2962,6 +2962,48 @@ int config_parse_blockio_bandwidth(
return 0;
}
+int config_parse_netclass(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ CGroupContext *c = data;
+ unsigned v;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ if (streq(rvalue, "auto")) {
+ c->netclass_type = CGROUP_NETCLASS_TYPE_AUTO;
+ return 0;
+ }
+
+ r = safe_atou32(rvalue, &v);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Netclass '%s' invalid. Ignoring.", rvalue);
+ return 0;
+ }
+
+ if (v > CGROUP_NETCLASS_FIXED_MAX)
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Fixed netclass %" PRIu32 " out of allowed range (0-%d). Applying anyway.", v, (uint32_t) CGROUP_NETCLASS_FIXED_MAX);
+
+ c->netclass_id = v;
+ c->netclass_type = CGROUP_NETCLASS_TYPE_FIXED;
+
+ return 0;
+}
+
DEFINE_CONFIG_PARSE_ENUM(config_parse_job_mode, job_mode, JobMode, "Failed to parse job mode");
int config_parse_job_mode_isolate(