xref: /aosp_15_r20/external/ltp/scripts/coccinelle/kselftest-cgroup-to-ltp.cocci (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker@@
2*49cdfc7eSAndroid Build Coastguard Workerexpression cgn, cgns;
3*49cdfc7eSAndroid Build Coastguard Worker@@
4*49cdfc7eSAndroid Build Coastguard Worker
5*49cdfc7eSAndroid Build Coastguard Worker- cgn = cg_name(..., cgns);
6*49cdfc7eSAndroid Build Coastguard Worker+ cgn = tst_cg_group_mk(cg_test, cgns);
7*49cdfc7eSAndroid Build Coastguard Worker
8*49cdfc7eSAndroid Build Coastguard Worker@@
9*49cdfc7eSAndroid Build Coastguard Workerexpression cg, fname, data;
10*49cdfc7eSAndroid Build Coastguard Worker@@
11*49cdfc7eSAndroid Build Coastguard Worker
12*49cdfc7eSAndroid Build Coastguard Worker- if (cg_write(cg, fname, data)) {
13*49cdfc7eSAndroid Build Coastguard Worker-    ...
14*49cdfc7eSAndroid Build Coastguard Worker- }
15*49cdfc7eSAndroid Build Coastguard Worker+ SAFE_CG_PRINT(cg, fname, data);
16*49cdfc7eSAndroid Build Coastguard Worker
17*49cdfc7eSAndroid Build Coastguard Worker@@
18*49cdfc7eSAndroid Build Coastguard Workerexpression cg;
19*49cdfc7eSAndroid Build Coastguard Worker@@
20*49cdfc7eSAndroid Build Coastguard Worker
21*49cdfc7eSAndroid Build Coastguard Worker... when != TST_CG_VER(...)
22*49cdfc7eSAndroid Build Coastguard Worker
23*49cdfc7eSAndroid Build Coastguard Worker- SAFE_CG_PRINT(cg, "cgroup.subtree_control", "+memory");
24*49cdfc7eSAndroid Build Coastguard Worker+ if (TST_CG_VER(cg, "memory") != TST_CG_V1)
25*49cdfc7eSAndroid Build Coastguard Worker+    SAFE_CG_PRINT(cg, "cgroup.subtree_control", "+memory");
26*49cdfc7eSAndroid Build Coastguard Worker
27*49cdfc7eSAndroid Build Coastguard Worker@@
28*49cdfc7eSAndroid Build Coastguard Workerexpression cg, fname, needle;
29*49cdfc7eSAndroid Build Coastguard Worker@@
30*49cdfc7eSAndroid Build Coastguard Worker
31*49cdfc7eSAndroid Build Coastguard Worker- cg_read_strstr(cg, fname, needle)
32*49cdfc7eSAndroid Build Coastguard Worker+ !SAFE_CG_OCCURSIN(cg, fname, needle)
33*49cdfc7eSAndroid Build Coastguard Worker
34*49cdfc7eSAndroid Build Coastguard Worker@@
35*49cdfc7eSAndroid Build Coastguard Workeridentifier l;
36*49cdfc7eSAndroid Build Coastguard Workerexpression cg, fname;
37*49cdfc7eSAndroid Build Coastguard Worker@@
38*49cdfc7eSAndroid Build Coastguard Worker
39*49cdfc7eSAndroid Build Coastguard Worker- l = cg_read_long(cg, fname);
40*49cdfc7eSAndroid Build Coastguard Worker+ SAFE_CG_SCANF(cg, fname, "%ld", &l);
41