]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup: Add a cgroup element to point to the owner in the controller
authorDhaval Giani <dhaval.giani@gmail.com>
Fri, 29 Jun 2012 09:37:39 +0000 (15:07 +0530)
committerDhaval Giani <dhaval.giani@gmail.com>
Thu, 2 Aug 2012 14:52:09 +0000 (10:52 -0400)
Since the only way to create a controller is from the wrapper API, it is
always linked to one cgroup. Since it would help knowing which cgroup a
controller belongs to, let's just add that information in there.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
src/libcgroup-internal.h
src/wrapper.c

index b253828e4467a1e29665c8c703963a679f0231e3..8bcfd969f82cdd426462475f072ab78e665bc6ea 100644 (file)
@@ -77,6 +77,7 @@ struct control_value {
 struct cgroup_controller {
        char name[FILENAME_MAX];
        struct control_value *values[CG_NV_MAX];
+       struct cgroup *cgroup;
        int index;
 };
 
index 4618005552202d4aeacac6813b2100d19640412f..dfcfc8f438cf740f781e632c207a6506ed791aba 100644 (file)
@@ -83,6 +83,7 @@ struct cgroup_controller *cgroup_add_controller(struct cgroup *cgroup,
                return NULL;
 
        strncpy(controller->name, name, sizeof(controller->name));
+       controller->cgroup = cgroup;
        controller->index = 0;
 
        cgroup->controller[cgroup->index] = controller;