<div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 26, 2022 at 11:56 PM Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>><br></blockquote><div><span class="gmail_default" style="font-size:small"></span></div><div class="gmail_default" style="font-size:small">Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>></div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 lib/tst_cgroup.c | 69 +++++++++++++++---------------------------------<br>
 1 file changed, 21 insertions(+), 48 deletions(-)<br>
<br>
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c<br>
index 6f24e0450..1cfd79243 100644<br>
--- a/lib/tst_cgroup.c<br>
+++ b/lib/tst_cgroup.c<br>
@@ -229,11 +229,11 @@ static const struct cgroup_file freezer_ctrl_files[] = {<br>
        { }<br>
 };<br>
<br>
-static const struct cgroup_file netcls_ctrl_files[] = {<br>
+static const struct cgroup_file net_cls_ctrl_files[] = {<br>
        { }<br>
 };<br>
<br>
-static const struct cgroup_file netprio_ctrl_files[] = {<br>
+static const struct cgroup_file net_prio_ctrl_files[] = {<br>
        { }<br>
 };<br>
<br>
@@ -254,54 +254,27 @@ static const struct cgroup_file debug_ctrl_files[] = {<br>
 };<br>
<br>
 #define CTRL_NAME_MAX 31<br>
+#define CGROUP_CTRL_MEMBER(x, y)[y] = { .ctrl_name = #x, .files = \<br>
+       x ## _ctrl_files, .ctrl_indx = y, NULL, 0 }<br>
+<br>
 /* Lookup tree for item names. */<br>
 static struct cgroup_ctrl controllers[] = {<br>
-       [0] = { "cgroup", cgroup_ctrl_files, 0, NULL, 0 },<br>
-       [CTRL_MEMORY] = {<br>
-               "memory", memory_ctrl_files, CTRL_MEMORY, NULL, 0<br>
-       },<br>
-       [CTRL_CPU] = {<br>
-               "cpu", cpu_ctrl_files, CTRL_CPU, NULL, 0<br>
-       },<br>
-       [CTRL_CPUSET] = {<br>
-               "cpuset", cpuset_ctrl_files, CTRL_CPUSET, NULL, 0<br>
-       },<br>
-       [CTRL_IO] = {<br>
-               "io", io_ctrl_files, CTRL_IO, NULL, 0<br>
-       },<br>
-       [CTRL_PIDS] = {<br>
-               "pids", pids_ctrl_files, CTRL_PIDS, NULL, 0<br>
-       },<br>
-       [CTRL_HUGETLB] = {<br>
-               "hugetlb", hugetlb_ctrl_files, CTRL_HUGETLB, NULL, 0<br>
-       },<br>
-       [CTRL_CPUACCT] = {<br>
-               "cpuacct", cpuacct_ctrl_files, CTRL_CPUACCT, NULL, 0<br>
-       },<br>
-       [CTRL_DEVICES] = {<br>
-               "devices", devices_ctrl_files, CTRL_DEVICES, NULL, 0<br>
-       },<br>
-       [CTRL_FREEZER] = {<br>
-               "freezer", freezer_ctrl_files, CTRL_FREEZER, NULL, 0<br>
-       },<br>
-       [CTRL_NETCLS] = {<br>
-               "net_cls", netcls_ctrl_files, CTRL_NETCLS, NULL, 0<br>
-       },<br>
-       [CTRL_NETPRIO] = {<br>
-               "net_prio", netprio_ctrl_files, CTRL_NETPRIO, NULL, 0<br>
-       },<br>
-       [CTRL_BLKIO] = {<br>
-               "blkio", blkio_ctrl_files, CTRL_BLKIO, NULL, 0<br>
-       },<br>
-       [CTRL_MISC] = {<br>
-               "misc", misc_ctrl_files, CTRL_MISC, NULL, 0<br>
-       },<br>
-       [CTRL_PERFEVENT] = {<br>
-               "perf_event", perf_event_ctrl_files, CTRL_PERFEVENT, NULL, 0<br>
-       },<br>
-       [CTRL_DEBUG] = {<br>
-               "debug", debug_ctrl_files, CTRL_DEBUG, NULL, 0<br>
-       },<br>
+       CGROUP_CTRL_MEMBER(cgroup, 0),<br>
+       CGROUP_CTRL_MEMBER(memory, CTRL_MEMORY),<br>
+       CGROUP_CTRL_MEMBER(cpu, CTRL_CPU),<br>
+       CGROUP_CTRL_MEMBER(cpuset, CTRL_CPUSET),<br>
+       CGROUP_CTRL_MEMBER(io, CTRL_IO),<br>
+       CGROUP_CTRL_MEMBER(pids, CTRL_PIDS),<br>
+       CGROUP_CTRL_MEMBER(hugetlb, CTRL_HUGETLB),<br>
+       CGROUP_CTRL_MEMBER(cpuacct, CTRL_CPUACCT),<br>
+       CGROUP_CTRL_MEMBER(devices, CTRL_DEVICES),<br>
+       CGROUP_CTRL_MEMBER(freezer, CTRL_FREEZER),<br>
+       CGROUP_CTRL_MEMBER(net_cls, CTRL_NETCLS),<br>
+       CGROUP_CTRL_MEMBER(net_prio, CTRL_NETPRIO),<br>
+       CGROUP_CTRL_MEMBER(blkio, CTRL_BLKIO),<br>
+       CGROUP_CTRL_MEMBER(misc, CTRL_MISC),<br>
+       CGROUP_CTRL_MEMBER(perf_event, CTRL_PERFEVENT),<br>
+       CGROUP_CTRL_MEMBER(debug, CTRL_DEBUG),<br>
        { }<br>
 };<br>
<br>
-- <br>
2.37.1<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div></div>