aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorPaul Menage <menage@google.com>2008-04-29 04:00:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:08 -0400
commit9179656961adcea3c25403365597e486d851ac5e (patch)
tree13acbdd7ae045ed46fa679e613783717eb3b9138 /include/linux/cgroup.h
parent700fe1ab99240c1a9c4d155e2a0612a1b044bb69 (diff)
CGroup API files: add cgroup map data type
Adds a new type of supported control file representation, a map from strings to u64 values. Each map entry is printed as a line in a similar format to /proc/vmstat, i.e. "$key $value\n" Signed-off-by: Paul Menage <menage@google.com> Cc: "Li Zefan" <lizf@cn.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Paul Jackson <pj@sgi.com> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: "YAMAMOTO Takashi" <yamamoto@valinux.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 058371c5d360..0a3ab670dd2f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -166,6 +166,16 @@ struct css_set {
166 166
167}; 167};
168 168
169/*
170 * cgroup_map_cb is an abstract callback API for reporting map-valued
171 * control files
172 */
173
174struct cgroup_map_cb {
175 int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value);
176 void *state;
177};
178
169/* struct cftype: 179/* struct cftype:
170 * 180 *
171 * The files in the cgroup filesystem mostly have a very simple read/write 181 * The files in the cgroup filesystem mostly have a very simple read/write
@@ -194,6 +204,15 @@ struct cftype {
194 * single integer. Use it in place of read() 204 * single integer. Use it in place of read()
195 */ 205 */
196 u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft); 206 u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft);
207 /*
208 * read_map() is used for defining a map of key/value
209 * pairs. It should call cb->fill(cb, key, value) for each
210 * entry. The key/value pairs (and their ordering) should not
211 * change between reboots.
212 */
213 int (*read_map) (struct cgroup *cont, struct cftype *cft,
214 struct cgroup_map_cb *cb);
215
197 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, 216 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft,
198 struct file *file, 217 struct file *file,
199 const char __user *buf, size_t nbytes, loff_t *ppos); 218 const char __user *buf, size_t nbytes, loff_t *ppos);