From: Richard Palethorpe <rpalethorpe@suse.de>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 2/3] tst_cgroup: Add safe_cg_open and safe_cg_fchown functions
Date: Thu, 25 Aug 2022 17:08:53 +0100 [thread overview]
Message-ID: <871qt42tev.fsf@suse.de> (raw)
In-Reply-To: <875yig2wuo.fsf@suse.de>
Richard Palethorpe <rpalethorpe@suse.de> writes:
> Hello,
>
> Yang Xu <xuyang2018.jy@fujitsu.com> writes:
>
>> safe_cg_open is used to open the sub control's file ie cgroup.procs
>> and returns the opened fd number. The opened fd array is stored in
>> fds argument.
>>
>> safe_cg_fchown is used to use fchownat to change file's uid and gid.
>>
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> ---
>> include/tst_cgroup.h | 44 +++++++++++++++++++++++++++++
>> lib/tst_cgroup.c | 66 +++++++++++++++++++++++++++-----------------
>> 2 files changed, 85 insertions(+), 25 deletions(-)
>>
>> diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
>> index d06847cc6..70c5b3fd4 100644
>> --- a/include/tst_cgroup.h
>> +++ b/include/tst_cgroup.h
>> @@ -89,6 +89,32 @@ enum tst_cg_ver {
>> TST_CG_V2 = 2,
>> };
>>
>> +/* Controller sub-systems */
>> +enum cgroup_ctrl_indx {
>> + CTRL_MEMORY = 1,
>> + CTRL_CPU,
>> + CTRL_CPUSET,
>> + CTRL_IO,
>> + CTRL_PIDS,
>> + CTRL_HUGETLB,
>> + CTRL_CPUACCT,
>> + CTRL_DEVICES,
>> + CTRL_FREEZER,
>> + CTRL_NETCLS,
>> + CTRL_NETPRIO,
>> + CTRL_BLKIO,
>> + CTRL_MISC,
>> + CTRL_PERFEVENT,
>> + CTRL_DEBUG
>> +};
>> +
>> +#define CTRLS_MAX CTRL_DEBUG
>> +
>> +/* At most we can have one cgroup V1 tree for each controller and one
>> + * (empty) v2 tree.
>> + */
>> +#define ROOTS_MAX (CTRLS_MAX + 1)
>
> These need TST_CG_ prepending to them to stop name collisions.
Actually, I think the easiest thing to do is not export these. Instead
you could leave these alone and export "#define TST_CG_ROOTS_MAX 32".
The rest of the patch-set looks great.
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-08-25 16:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 10:19 [LTP] [PATCH v1 1/3] tst_safe_file_at: Add SAFE_FCHOWNAT macro Yang Xu
2022-08-03 10:19 ` [LTP] [PATCH v1 2/3] tst_cgroup: Add safe_cg_open and safe_cg_fchown functions Yang Xu
2022-08-04 10:24 ` Richard Palethorpe
2022-08-16 6:19 ` xuyang2018.jy
2022-08-16 8:18 ` Richard Palethorpe
2022-08-18 8:05 ` xuyang2018.jy
2022-08-18 9:03 ` Richard Palethorpe
2022-08-23 7:10 ` xuyang2018.jy
2022-08-23 9:55 ` xuyang2018.jy
2022-08-18 9:00 ` [LTP] [RFC v2 1/3] tst_safe_file_at: Add SAFE_FCHOWNAT macro Yang Xu
2022-08-18 9:00 ` [LTP] [RFC v2 2/3] tst_cgroup: Add safe_cg_open and safe_cg_fchown functions Yang Xu
2022-08-18 9:00 ` [LTP] [RFC v2 3/3] memcontrol05: copy from kernel selftest test_cgcore_lesser_euid_open Yang Xu
2022-08-23 11:01 ` [LTP] [PATCH v3 1/3] tst_safe_file_at: Add SAFE_FCHOWNAT macro Yang Xu
2022-08-23 11:01 ` [LTP] [PATCH v3 2/3] tst_cgroup: Add safe_cg_open and safe_cg_fchown functions Yang Xu
2022-08-25 14:57 ` Richard Palethorpe
2022-08-25 16:08 ` Richard Palethorpe [this message]
2022-08-26 2:04 ` xuyang2018.jy
2022-08-26 3:59 ` [LTP] [PATCH v4 1/3] tst_safe_file_at: Add SAFE_FCHOWNAT macro Yang Xu
2022-08-26 3:59 ` [LTP] [PATCH v4 2/3] tst_cgroup: Add safe_cg_open and safe_cg_fchown functions Yang Xu
2022-08-26 5:54 ` Richard Palethorpe
2022-08-26 6:33 ` xuyang2018.jy
2022-08-26 3:59 ` [LTP] [PATCH v4 3/3] cgroup_core01: copy from kernel selftest test_cgcore_lesser_euid_open Yang Xu
2022-08-23 11:01 ` [LTP] [PATCH v3 3/3] core01: " Yang Xu
2022-08-03 10:19 ` [LTP] [PATCH v1 3/3] memcontrol05: " Yang Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871qt42tev.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
--cc=xuyang2018.jy@fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.