From 4efb9b682b6133a13044c1f70aa96de1fd64c36c Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Thu, 29 Oct 2009 15:47:52 +0100 Subject: Remove the CG_HIER_MAX from tools-common Some libcgroup tools are limited to CG_HIER_MAX arguments. This hard limit is suitable only to some of the tools, namely cgdelete and cgcreate should not be limited to any particular numbers of groups to create/delete. This patches removes the hard limit from tools-common.c and puts it to the individual tools. Signed-off-by: Jan Safranek Signed-off-by: Dhaval Giani --- src/tools/tools-common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/tools/tools-common.c') diff --git a/src/tools/tools-common.c b/src/tools/tools-common.c index db46f6e..4beffcd 100644 --- a/src/tools/tools-common.c +++ b/src/tools/tools-common.c @@ -22,7 +22,8 @@ #include #include "tools-common.h" -int parse_cgroup_spec(struct cgroup_group_spec *cdptr[], char *optarg) +int parse_cgroup_spec(struct cgroup_group_spec **cdptr, char *optarg, + int capacity) { struct cgroup_group_spec *ptr; int i, j; @@ -31,15 +32,15 @@ int parse_cgroup_spec(struct cgroup_group_spec *cdptr[], char *optarg) ptr = *cdptr; /* Find first free entry inside the cgroup data array */ - for (i = 0; i < CG_HIER_MAX; i++, ptr++) { + for (i = 0; i < capacity; i++, ptr++) { if (!cdptr[i]) break; } - if (i == CG_HIER_MAX) { + if (i == capacity) { /* No free slot found */ fprintf(stderr, "Max allowed hierarchies %d reached\n", - CG_HIER_MAX); + capacity); return -1; } -- cgit