diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2008-04-29 04:00:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:10 -0400 |
commit | 29486df325e1fe6e1764afcb19e3370804c2b002 (patch) | |
tree | d69a96bb829940f3ae5171fde481edb20a9e468a /kernel/cgroup.c | |
parent | 28fd5dfc12bde391981dfdcf20755952b6e916af (diff) |
cgroups: introduce cft->read_seq()
Introduce a read_seq() helper in cftype, which uses seq_file to print out
lists. Use it in the devices cgroup. Also split devices.allow into two
files, so now devices.deny and devices.allow are the ones to use to manipulate
the whitelist, while devices.list outputs the cgroup's current whitelist.
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Acked-by: Paul Menage <menage@google.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index aeceb8868981..abc433772e5a 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1549,11 +1549,14 @@ static int cgroup_seqfile_show(struct seq_file *m, void *arg) | |||
1549 | { | 1549 | { |
1550 | struct cgroup_seqfile_state *state = m->private; | 1550 | struct cgroup_seqfile_state *state = m->private; |
1551 | struct cftype *cft = state->cft; | 1551 | struct cftype *cft = state->cft; |
1552 | struct cgroup_map_cb cb = { | 1552 | if (cft->read_map) { |
1553 | .fill = cgroup_map_add, | 1553 | struct cgroup_map_cb cb = { |
1554 | .state = m, | 1554 | .fill = cgroup_map_add, |
1555 | }; | 1555 | .state = m, |
1556 | return cft->read_map(state->cgroup, cft, &cb); | 1556 | }; |
1557 | return cft->read_map(state->cgroup, cft, &cb); | ||
1558 | } | ||
1559 | return cft->read_seq_string(state->cgroup, cft, m); | ||
1557 | } | 1560 | } |
1558 | 1561 | ||
1559 | int cgroup_seqfile_release(struct inode *inode, struct file *file) | 1562 | int cgroup_seqfile_release(struct inode *inode, struct file *file) |
@@ -1581,7 +1584,7 @@ static int cgroup_file_open(struct inode *inode, struct file *file) | |||
1581 | cft = __d_cft(file->f_dentry); | 1584 | cft = __d_cft(file->f_dentry); |
1582 | if (!cft) | 1585 | if (!cft) |
1583 | return -ENODEV; | 1586 | return -ENODEV; |
1584 | if (cft->read_map) { | 1587 | if (cft->read_map || cft->read_seq_string) { |
1585 | struct cgroup_seqfile_state *state = | 1588 | struct cgroup_seqfile_state *state = |
1586 | kzalloc(sizeof(*state), GFP_USER); | 1589 | kzalloc(sizeof(*state), GFP_USER); |
1587 | if (!state) | 1590 | if (!state) |