aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-01 15:09:55 -0400
committerTejun Heo <tj@kernel.org>2012-04-01 15:09:55 -0400
commit676f7c8f84d15e94065841529016da5ab92e901b (patch)
tree29c267a4c5711f9eaca7fa88fd7a78d39c8c4eac /net/ipv4
parent6e6ff25bd548a0c5bf5163e4f63e2793dcefbdcb (diff)
cgroup: relocate cftype and cgroup_subsys definitions in controllers
blk-cgroup, netprio_cgroup, cls_cgroup and tcp_memcontrol unnecessarily define cftype array and cgroup_subsys structures at the top of the file, which is unconventional and necessiates forward declaration of methods. This patch relocates those below the definitions of the methods and removes the forward declarations. Note that forward declaration of tcp_files[] is added in tcp_memcontrol.c for tcp_init_cgroup(). This will be removed soon by another patch. This patch doesn't introduce any functional change. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_memcontrol.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c
index e795272fbe9..4d3ee407d2d 100644
--- a/net/ipv4/tcp_memcontrol.c
+++ b/net/ipv4/tcp_memcontrol.c
@@ -6,36 +6,7 @@
6#include <linux/memcontrol.h> 6#include <linux/memcontrol.h>
7#include <linux/module.h> 7#include <linux/module.h>
8 8
9static u64 tcp_cgroup_read(struct cgroup *cont, struct cftype *cft); 9static struct cftype tcp_files[4]; /* XXX: will be removed soon */
10static int tcp_cgroup_write(struct cgroup *cont, struct cftype *cft,
11 const char *buffer);
12static int tcp_cgroup_reset(struct cgroup *cont, unsigned int event);
13
14static struct cftype tcp_files[] = {
15 {
16 .name = "kmem.tcp.limit_in_bytes",
17 .write_string = tcp_cgroup_write,
18 .read_u64 = tcp_cgroup_read,
19 .private = RES_LIMIT,
20 },
21 {
22 .name = "kmem.tcp.usage_in_bytes",
23 .read_u64 = tcp_cgroup_read,
24 .private = RES_USAGE,
25 },
26 {
27 .name = "kmem.tcp.failcnt",
28 .private = RES_FAILCNT,
29 .trigger = tcp_cgroup_reset,
30 .read_u64 = tcp_cgroup_read,
31 },
32 {
33 .name = "kmem.tcp.max_usage_in_bytes",
34 .private = RES_MAX_USAGE,
35 .trigger = tcp_cgroup_reset,
36 .read_u64 = tcp_cgroup_read,
37 },
38};
39 10
40static inline struct tcp_memcontrol *tcp_from_cgproto(struct cg_proto *cg_proto) 11static inline struct tcp_memcontrol *tcp_from_cgproto(struct cg_proto *cg_proto)
41{ 12{
@@ -270,3 +241,29 @@ void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx)
270 241
271 tcp->tcp_prot_mem[idx] = val; 242 tcp->tcp_prot_mem[idx] = val;
272} 243}
244
245static struct cftype tcp_files[] = {
246 {
247 .name = "kmem.tcp.limit_in_bytes",
248 .write_string = tcp_cgroup_write,
249 .read_u64 = tcp_cgroup_read,
250 .private = RES_LIMIT,
251 },
252 {
253 .name = "kmem.tcp.usage_in_bytes",
254 .read_u64 = tcp_cgroup_read,
255 .private = RES_USAGE,
256 },
257 {
258 .name = "kmem.tcp.failcnt",
259 .private = RES_FAILCNT,
260 .trigger = tcp_cgroup_reset,
261 .read_u64 = tcp_cgroup_read,
262 },
263 {
264 .name = "kmem.tcp.max_usage_in_bytes",
265 .private = RES_MAX_USAGE,
266 .trigger = tcp_cgroup_reset,
267 .read_u64 = tcp_cgroup_read,
268 },
269};