Re: [PATCH 03/11] cgroup: bring some sanity to naming around cg_cgroup_link

From: Li Zefan
Date: Wed Jun 12 2013 - 22:35:25 EST


On 2013/6/13 5:03, Tejun Heo wrote:
> cgroups and css_sets are mapped M:N and this M:N mapping is
> represented by struct cg_cgroup_link which points to forms linked
> lists on both sides. The naming around this already confusing struct
> is pretty bad.
>
>>From cgroup side, it starts off ->css_sets and runs through
> ->cgrp_link_list. From css_set side, it starts off ->cg_links and
> runs through ->cg_link_list. This is rather reversed as
> cgrp_link_list is used to iterate css_sets and cg_link_list cgroups.
> Also, this is the only place which is still using the confusing "cg"
> for css_sets. This patch cleans it up a bit.
>
> * s/cgroup->css_sets/cgroup->cset_links/
> s/css_set->cg_links/css_set->cgrp_links/
> s/cgroup_iter->cg_link/cgroup_iter->cset_link/
>
> * s/cg_cgroup_link/cgrp_cset_link/
>
> * s/cgrp_cset_link->cg/cgrp_cset_link->cset/
> s/cgrp_cset_link->cgrp_link_list/cgrp_cset_link->cset_link/
> s/cgrp_cset_link->cg_link_list/cgrp_cset_link->cgrp_link/
>
> * s/init_css_set_link/init_cgrp_cset_link/
> s/free_cg_links/free_cgrp_cset_links/
> s/allocate_cg_links/allocate_cgrp_cset_links/
>
> * s/cgl[12]/link[12]/ in compare_css_sets()
>
> * s/saved_link/tmp_link/ s/tmp/tmp_links/ and a couple similar
> adustments.
>
> * Comment and whiteline adjustments.
>
> After the changes, we have
>
> list_for_each_entry(link, &cont->cset_links, cset_link) {
> struct css_set *cset = link->cset;
>
> instead of
>
> list_for_each_entry(link, &cont->css_sets, cgrp_link_list) {
> struct css_set *cset = link->cg;
>

Those renames really make the code more readable! I have to think for a while
everytime I see those namings.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/