diff options
Diffstat (limited to 'net/sched/cls_cgroup.c')
-rw-r--r-- | net/sched/cls_cgroup.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index e4877ca6727c..7f27d2c15e08 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -24,6 +24,25 @@ struct cgroup_cls_state | |||
24 | u32 classid; | 24 | u32 classid; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss, | ||
28 | struct cgroup *cgrp); | ||
29 | static void cgrp_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp); | ||
30 | static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp); | ||
31 | |||
32 | struct cgroup_subsys net_cls_subsys = { | ||
33 | .name = "net_cls", | ||
34 | .create = cgrp_create, | ||
35 | .destroy = cgrp_destroy, | ||
36 | .populate = cgrp_populate, | ||
37 | #ifdef CONFIG_NET_CLS_CGROUP | ||
38 | .subsys_id = net_cls_subsys_id, | ||
39 | #else | ||
40 | #define net_cls_subsys_id net_cls_subsys.subsys_id | ||
41 | #endif | ||
42 | .module = THIS_MODULE, | ||
43 | }; | ||
44 | |||
45 | |||
27 | static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) | 46 | static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) |
28 | { | 47 | { |
29 | return container_of(cgroup_subsys_state(cgrp, net_cls_subsys_id), | 48 | return container_of(cgroup_subsys_state(cgrp, net_cls_subsys_id), |
@@ -79,14 +98,6 @@ static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp) | |||
79 | return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files)); | 98 | return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files)); |
80 | } | 99 | } |
81 | 100 | ||
82 | struct cgroup_subsys net_cls_subsys = { | ||
83 | .name = "net_cls", | ||
84 | .create = cgrp_create, | ||
85 | .destroy = cgrp_destroy, | ||
86 | .populate = cgrp_populate, | ||
87 | .subsys_id = net_cls_subsys_id, | ||
88 | }; | ||
89 | |||
90 | struct cls_cgroup_head | 101 | struct cls_cgroup_head |
91 | { | 102 | { |
92 | u32 handle; | 103 | u32 handle; |
@@ -277,12 +288,19 @@ static struct tcf_proto_ops cls_cgroup_ops __read_mostly = { | |||
277 | 288 | ||
278 | static int __init init_cgroup_cls(void) | 289 | static int __init init_cgroup_cls(void) |
279 | { | 290 | { |
280 | return register_tcf_proto_ops(&cls_cgroup_ops); | 291 | int ret = register_tcf_proto_ops(&cls_cgroup_ops); |
292 | if (ret) | ||
293 | return ret; | ||
294 | ret = cgroup_load_subsys(&net_cls_subsys); | ||
295 | if (ret) | ||
296 | unregister_tcf_proto_ops(&cls_cgroup_ops); | ||
297 | return ret; | ||
281 | } | 298 | } |
282 | 299 | ||
283 | static void __exit exit_cgroup_cls(void) | 300 | static void __exit exit_cgroup_cls(void) |
284 | { | 301 | { |
285 | unregister_tcf_proto_ops(&cls_cgroup_ops); | 302 | unregister_tcf_proto_ops(&cls_cgroup_ops); |
303 | cgroup_unload_subsys(&net_cls_subsys); | ||
286 | } | 304 | } |
287 | 305 | ||
288 | module_init(init_cgroup_cls); | 306 | module_init(init_cgroup_cls); |