diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 13:50:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 13:50:47 -0400 |
commit | c0e8a139a5bb8add02b4111e9e1957d810d7285e (patch) | |
tree | f5f0695c7553c0f651ea3c714191dedf76e06c78 /include/linux/cgroup.h | |
parent | 033d9959ed2dc1029217d4165f80a71702dc578e (diff) | |
parent | a6f00298b2ceaf50b4ab00e6ee3eb0206ac72fac (diff) |
Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo:
- xattr support added. The implementation is shared with tmpfs. The
usage is restricted and intended to be used to manage per-cgroup
metadata by system software. tmpfs changes are routed through this
branch with Hugh's permission.
- cgroup subsystem ID handling simplified.
* 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
cgroup: Define CGROUP_SUBSYS_COUNT according the configuration
cgroup: Assign subsystem IDs during compile time
cgroup: Do not depend on a given order when populating the subsys array
cgroup: Wrap subsystem selection macro
cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
cgroup: net_prio: Do not define task_netpioidx() when not selected
cgroup: net_cls: Do not define task_cls_classid() when not selected
cgroup: net_cls: Move sock_update_classid() declaration to cls_cgroup.h
cgroup: trivial fixes for Documentation/cgroups/cgroups.txt
xattr: mark variable as uninitialized to make both gcc and smatch happy
fs: add missing documentation to simple_xattr functions
cgroup: add documentation on extended attributes usage
cgroup: rename subsys_bits to subsys_mask
cgroup: add xattr support
cgroup: revise how we re-populate root directory
xattr: extract simple_xattr code from tmpfs
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r-- | include/linux/cgroup.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index c90eaa803440..df354ae079c1 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/rwsem.h> | 17 | #include <linux/rwsem.h> |
18 | #include <linux/idr.h> | 18 | #include <linux/idr.h> |
19 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
20 | #include <linux/xattr.h> | ||
20 | 21 | ||
21 | #ifdef CONFIG_CGROUPS | 22 | #ifdef CONFIG_CGROUPS |
22 | 23 | ||
@@ -45,17 +46,13 @@ extern const struct file_operations proc_cgroup_operations; | |||
45 | 46 | ||
46 | /* Define the enumeration of all builtin cgroup subsystems */ | 47 | /* Define the enumeration of all builtin cgroup subsystems */ |
47 | #define SUBSYS(_x) _x ## _subsys_id, | 48 | #define SUBSYS(_x) _x ## _subsys_id, |
49 | #define IS_SUBSYS_ENABLED(option) IS_ENABLED(option) | ||
48 | enum cgroup_subsys_id { | 50 | enum cgroup_subsys_id { |
49 | #include <linux/cgroup_subsys.h> | 51 | #include <linux/cgroup_subsys.h> |
50 | CGROUP_BUILTIN_SUBSYS_COUNT | 52 | CGROUP_SUBSYS_COUNT, |
51 | }; | 53 | }; |
54 | #undef IS_SUBSYS_ENABLED | ||
52 | #undef SUBSYS | 55 | #undef SUBSYS |
53 | /* | ||
54 | * This define indicates the maximum number of subsystems that can be loaded | ||
55 | * at once. We limit to this many since cgroupfs_root has subsys_bits to keep | ||
56 | * track of all of them. | ||
57 | */ | ||
58 | #define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long)) | ||
59 | 56 | ||
60 | /* Per-subsystem/per-cgroup state maintained by the system. */ | 57 | /* Per-subsystem/per-cgroup state maintained by the system. */ |
61 | struct cgroup_subsys_state { | 58 | struct cgroup_subsys_state { |
@@ -216,6 +213,9 @@ struct cgroup { | |||
216 | /* List of events which userspace want to receive */ | 213 | /* List of events which userspace want to receive */ |
217 | struct list_head event_list; | 214 | struct list_head event_list; |
218 | spinlock_t event_list_lock; | 215 | spinlock_t event_list_lock; |
216 | |||
217 | /* directory xattrs */ | ||
218 | struct simple_xattrs xattrs; | ||
219 | }; | 219 | }; |
220 | 220 | ||
221 | /* | 221 | /* |
@@ -309,6 +309,9 @@ struct cftype { | |||
309 | /* CFTYPE_* flags */ | 309 | /* CFTYPE_* flags */ |
310 | unsigned int flags; | 310 | unsigned int flags; |
311 | 311 | ||
312 | /* file xattrs */ | ||
313 | struct simple_xattrs xattrs; | ||
314 | |||
312 | int (*open)(struct inode *inode, struct file *file); | 315 | int (*open)(struct inode *inode, struct file *file); |
313 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, | 316 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, |
314 | struct file *file, | 317 | struct file *file, |
@@ -394,7 +397,7 @@ struct cftype { | |||
394 | */ | 397 | */ |
395 | struct cftype_set { | 398 | struct cftype_set { |
396 | struct list_head node; /* chained at subsys->cftsets */ | 399 | struct list_head node; /* chained at subsys->cftsets */ |
397 | const struct cftype *cfts; | 400 | struct cftype *cfts; |
398 | }; | 401 | }; |
399 | 402 | ||
400 | struct cgroup_scanner { | 403 | struct cgroup_scanner { |
@@ -406,8 +409,8 @@ struct cgroup_scanner { | |||
406 | void *data; | 409 | void *data; |
407 | }; | 410 | }; |
408 | 411 | ||
409 | int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); | 412 | int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
410 | int cgroup_rm_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); | 413 | int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
411 | 414 | ||
412 | int cgroup_is_removed(const struct cgroup *cgrp); | 415 | int cgroup_is_removed(const struct cgroup *cgrp); |
413 | 416 | ||
@@ -521,7 +524,9 @@ struct cgroup_subsys { | |||
521 | }; | 524 | }; |
522 | 525 | ||
523 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; | 526 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; |
527 | #define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option) | ||
524 | #include <linux/cgroup_subsys.h> | 528 | #include <linux/cgroup_subsys.h> |
529 | #undef IS_SUBSYS_ENABLED | ||
525 | #undef SUBSYS | 530 | #undef SUBSYS |
526 | 531 | ||
527 | static inline struct cgroup_subsys_state *cgroup_subsys_state( | 532 | static inline struct cgroup_subsys_state *cgroup_subsys_state( |