On Fri, Jan 11, 2013 at 5:48 PM, Ivana Hutarova Varekova < varek...@redhat.com> wrote:
> cgconfig.conf: this patch add structures : MAX_TEMPLATES, > config_template_table, config_template_table_index and the body of > functions: template_config_insert_cgroup, > template_config_parse_controller_options > The structures stored the content of "template" tag from configuration > file "cgconfig.conf". The structure have the same meaning as have > structures for control groups tag. > > CHANGELOG: > create enum instead of constants > > Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com> > Acked-By: Jan Safranek <jsafr...@redhat.com> > --- > > src/api.c | 6 + > src/config.c | 270 > +++++++++++++++++++++++++++++++++++++++++++++++++--------- > 2 files changed, 230 insertions(+), 46 deletions(-) > > diff --git a/src/api.c b/src/api.c > index 2259041..f889787 100644 > --- a/src/api.c > +++ b/src/api.c > @@ -2690,11 +2690,12 @@ char *cgroup_copy_with_slash(char *input) > } > > /* add controller to a group if it is not exists create it */ > -static int add_controller(struct cgroup *group, char *group_name, > +static int add_controller(struct cgroup **pgroup, char *group_name, > char controller_name[FILENAME_MAX]) > { > int ret = 0; > struct cgroup_controller *controller = NULL; > + struct cgroup *group = pgroup[0]; > > if (group == NULL) { > /* it is the first controllerc the group have to be > created */ > @@ -2703,6 +2704,7 @@ static int add_controller(struct cgroup *group, char > *group_name, > ret = ECGFAIL; > goto end; > } > + pgroup[0] = group; > } > > controller = cgroup_add_controller( > @@ -2775,7 +2777,7 @@ static int cgroup_create_template_group(char > *orig_group_name, > > if (exist != 0) { > /* the cgroup does not exist */ > - ret = add_controller(template_group, > group_name, > + ret = add_controller(&template_group, > group_name, > tmp->controllers[i]); > if (ret != 0) { > goto while_end; > diff --git a/src/config.c b/src/config.c > index 59b3383..6281767 100644 > --- a/src/config.c > +++ b/src/config.c > @@ -42,6 +42,13 @@ > #include <sys/types.h> > > unsigned int MAX_CGROUPS = 64; /* NOTE: This value changes dynamically */ > +unsigned int MAX_TEMPLATES = 64; > + /* NOTE: This value changes dynamically */ > + > +enum tc_switch_t { > + CGROUP, > + TEMPLATE, > +}; > Name conflicts? (so, CG_TEMPLATE_CGROUP might work better (don't use that, its ugly :P) or at least we need to keep a track of what we are using where?) (Or at least note in the changelog why we don't need to worry about name conflcts) The rest of the patch seems to be fine. Would it be possible to split it further to implementing just one function at a time, as opposde to the the entire bunch? Dhaval ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel