CGroup API files: add cgroup map data type
[safe/jmp/linux-2.6] / include / linux / cgroup.h
index 058371c..0a3ab67 100644 (file)
@@ -166,6 +166,16 @@ struct css_set {
 
 };
 
+/*
+ * cgroup_map_cb is an abstract callback API for reporting map-valued
+ * control files
+ */
+
+struct cgroup_map_cb {
+       int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value);
+       void *state;
+};
+
 /* struct cftype:
  *
  * The files in the cgroup filesystem mostly have a very simple read/write
@@ -194,6 +204,15 @@ struct cftype {
         * single integer. Use it in place of read()
         */
        u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft);
+       /*
+        * read_map() is used for defining a map of key/value
+        * pairs. It should call cb->fill(cb, key, value) for each
+        * entry. The key/value pairs (and their ordering) should not
+        * change between reboots.
+        */
+       int (*read_map) (struct cgroup *cont, struct cftype *cft,
+                        struct cgroup_map_cb *cb);
+
        ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft,
                          struct file *file,
                          const char __user *buf, size_t nbytes, loff_t *ppos);