Commit f572bc4e authored by Pavel Emelyanov's avatar Pavel Emelyanov

cg: Rename controllers field

We have to many controllers names in cgroup.c file.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
parent ff90710c
...@@ -518,8 +518,8 @@ static int dump_controllers(CgroupEntry *cg) ...@@ -518,8 +518,8 @@ static int dump_controllers(CgroupEntry *cg)
list_for_each_entry(cur, &cgroups, l) { list_for_each_entry(cur, &cgroups, l) {
cg_controller_entry__init(ce); cg_controller_entry__init(ce);
ce->controllers = cur->controllers; ce->cnames = cur->controllers;
ce->n_controllers = cur->n_controllers; ce->n_cnames = cur->n_controllers;
ce->n_dirs = cur->n_heads; ce->n_dirs = cur->n_heads;
if (ce->n_dirs > 0) if (ce->n_dirs > 0)
if (dump_cg_dirs(&cur->heads, cur->n_heads, &ce->dirs) < 0) { if (dump_cg_dirs(&cur->heads, cur->n_heads, &ce->dirs) < 0) {
...@@ -644,7 +644,7 @@ static int move_in_cgroup(CgSetEntry *se) ...@@ -644,7 +644,7 @@ static int move_in_cgroup(CgSetEntry *se)
for (j = 0; j < n_controllers; j++) { for (j = 0; j < n_controllers; j++) {
CgControllerEntry *cur = controllers[j]; CgControllerEntry *cur = controllers[j];
if (cgroup_contains(cur->controllers, cur->n_controllers, ce->name)) { if (cgroup_contains(cur->cnames, cur->n_cnames, ce->name)) {
ctrl = cur; ctrl = cur;
break; break;
} }
...@@ -656,12 +656,12 @@ static int move_in_cgroup(CgSetEntry *se) ...@@ -656,12 +656,12 @@ static int move_in_cgroup(CgSetEntry *se)
} }
aux_off = 0; aux_off = 0;
for (j = 0; j < ctrl->n_controllers; j++) { for (j = 0; j < ctrl->n_cnames; j++) {
char *name; char *name;
if (strstartswith(ce->name, "name=")) if (strstartswith(ce->name, "name="))
name = ctrl->controllers[j] + 5; name = ctrl->cnames[j] + 5;
else else
name = ctrl->controllers[j]; name = ctrl->cnames[j];
aux_off += sprintf(aux + aux_off, "%s,", name); aux_off += sprintf(aux + aux_off, "%s,", name);
} }
...@@ -804,24 +804,24 @@ static int prepare_cgroup_sfd(CgroupEntry *ce) ...@@ -804,24 +804,24 @@ static int prepare_cgroup_sfd(CgroupEntry *ce)
int j, name_off, opt_off; int j, name_off, opt_off;
char name[1024], opt[1024]; char name[1024], opt[1024];
if (ctrl->n_controllers < 1) { if (ctrl->n_cnames < 1) {
pr_err("Each cg_controller_entry must have at least 1 controller"); pr_err("Each cg_controller_entry must have at least 1 controller");
goto err; goto err;
} }
opt_off = 0; opt_off = 0;
if (strstartswith(ctrl->controllers[0], "name=")) if (strstartswith(ctrl->cnames[0], "name="))
opt_off = sprintf(opt, "none,"); opt_off = sprintf(opt, "none,");
name_off = 0; name_off = 0;
for (j = 0; j < ctrl->n_controllers; j++) { for (j = 0; j < ctrl->n_cnames; j++) {
char *n = ctrl->controllers[j]; char *n = ctrl->cnames[j];
if (strstartswith(ctrl->controllers[j], "name=")) if (strstartswith(ctrl->cnames[j], "name="))
n += 5; n += 5;
name_off += sprintf(name + name_off, "%s,", n); name_off += sprintf(name + name_off, "%s,", n);
opt_off += sprintf(opt + opt_off, "%s,", ctrl->controllers[j]); opt_off += sprintf(opt + opt_off, "%s,", ctrl->cnames[j]);
} }
/* Chop off the last ',' to keep mount() happy. */ /* Chop off the last ',' to keep mount() happy. */
......
...@@ -4,7 +4,7 @@ message cgroup_dir_entry { ...@@ -4,7 +4,7 @@ message cgroup_dir_entry {
} }
message cg_controller_entry { message cg_controller_entry {
repeated string controllers = 1; repeated string cnames = 1;
repeated cgroup_dir_entry dirs = 2; repeated cgroup_dir_entry dirs = 2;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment