diff options
Diffstat (limited to 'include/linux/cgroup.h')
| -rw-r--r-- | include/linux/cgroup.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index ad2a14680b7f..af6211c7a42b 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -192,6 +192,7 @@ struct cgroup { | |||
| 192 | struct list_head css_sets; | 192 | struct list_head css_sets; |
| 193 | 193 | ||
| 194 | struct list_head allcg_node; /* cgroupfs_root->allcg_list */ | 194 | struct list_head allcg_node; /* cgroupfs_root->allcg_list */ |
| 195 | struct list_head cft_q_node; /* used during cftype add/rm */ | ||
| 195 | 196 | ||
| 196 | /* | 197 | /* |
| 197 | * Linked list running through all cgroups that can | 198 | * Linked list running through all cgroups that can |
| @@ -277,11 +278,17 @@ struct cgroup_map_cb { | |||
| 277 | * - the 'cftype' of the file is file->f_dentry->d_fsdata | 278 | * - the 'cftype' of the file is file->f_dentry->d_fsdata |
| 278 | */ | 279 | */ |
| 279 | 280 | ||
| 280 | #define MAX_CFTYPE_NAME 64 | 281 | /* cftype->flags */ |
| 282 | #define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ | ||
| 283 | #define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create onp root cg */ | ||
| 284 | |||
| 285 | #define MAX_CFTYPE_NAME 64 | ||
| 286 | |||
| 281 | struct cftype { | 287 | struct cftype { |
| 282 | /* | 288 | /* |
| 283 | * By convention, the name should begin with the name of the | 289 | * By convention, the name should begin with the name of the |
| 284 | * subsystem, followed by a period | 290 | * subsystem, followed by a period. Zero length string indicates |
| 291 | * end of cftype array. | ||
| 285 | */ | 292 | */ |
| 286 | char name[MAX_CFTYPE_NAME]; | 293 | char name[MAX_CFTYPE_NAME]; |
| 287 | int private; | 294 | int private; |
| @@ -297,6 +304,9 @@ struct cftype { | |||
| 297 | */ | 304 | */ |
| 298 | size_t max_write_len; | 305 | size_t max_write_len; |
| 299 | 306 | ||
| 307 | /* CFTYPE_* flags */ | ||
| 308 | unsigned int flags; | ||
| 309 | |||
| 300 | int (*open)(struct inode *inode, struct file *file); | 310 | int (*open)(struct inode *inode, struct file *file); |
| 301 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, | 311 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, |
| 302 | struct file *file, | 312 | struct file *file, |
| @@ -375,6 +385,16 @@ struct cftype { | |||
| 375 | struct eventfd_ctx *eventfd); | 385 | struct eventfd_ctx *eventfd); |
| 376 | }; | 386 | }; |
| 377 | 387 | ||
| 388 | /* | ||
| 389 | * cftype_sets describe cftypes belonging to a subsystem and are chained at | ||
| 390 | * cgroup_subsys->cftsets. Each cftset points to an array of cftypes | ||
| 391 | * terminated by zero length name. | ||
| 392 | */ | ||
| 393 | struct cftype_set { | ||
| 394 | struct list_head node; /* chained at subsys->cftsets */ | ||
| 395 | const struct cftype *cfts; | ||
| 396 | }; | ||
| 397 | |||
| 378 | struct cgroup_scanner { | 398 | struct cgroup_scanner { |
| 379 | struct cgroup *cg; | 399 | struct cgroup *cg; |
| 380 | int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan); | 400 | int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan); |
| @@ -400,6 +420,8 @@ int cgroup_add_files(struct cgroup *cgrp, | |||
| 400 | const struct cftype cft[], | 420 | const struct cftype cft[], |
| 401 | int count); | 421 | int count); |
| 402 | 422 | ||
| 423 | int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); | ||
| 424 | |||
| 403 | int cgroup_is_removed(const struct cgroup *cgrp); | 425 | int cgroup_is_removed(const struct cgroup *cgrp); |
| 404 | 426 | ||
| 405 | int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); | 427 | int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); |
| @@ -502,6 +524,13 @@ struct cgroup_subsys { | |||
| 502 | struct idr idr; | 524 | struct idr idr; |
| 503 | spinlock_t id_lock; | 525 | spinlock_t id_lock; |
| 504 | 526 | ||
| 527 | /* list of cftype_sets */ | ||
| 528 | struct list_head cftsets; | ||
| 529 | |||
| 530 | /* base cftypes, automatically [de]registered with subsys itself */ | ||
| 531 | struct cftype *base_cftypes; | ||
| 532 | struct cftype_set base_cftset; | ||
| 533 | |||
| 505 | /* should be defined only by modular subsystems */ | 534 | /* should be defined only by modular subsystems */ |
| 506 | struct module *module; | 535 | struct module *module; |
| 507 | }; | 536 | }; |
