From 24de1da89def830bcc267e57da0d7f0bb8dcb904 Mon Sep 17 00:00:00 2001 From: Dhaval Giani Date: Fri, 29 Jun 2012 15:07:39 +0530 Subject: [PATCH] libcgroup: Add a cgroup element to point to the owner in the controller 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 Cc: Glauber Costa --- src/libcgroup-internal.h | 1 + src/wrapper.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h index b253828e..8bcfd969 100644 --- a/src/libcgroup-internal.h +++ b/src/libcgroup-internal.h @@ -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; }; diff --git a/src/wrapper.c b/src/wrapper.c index 46180055..dfcfc8f4 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -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; -- 2.47.2