Re: [PATCH -next] cgroup: Use descriptor table to unify mount flag management
From: Chen Ridong
Date: Mon Dec 01 2025 - 20:12:57 EST
On 2025/11/26 10:08, Chen Ridong wrote:
> From: Chen Ridong <chenridong@xxxxxxxxxx>
>
> The cgroup2 mount flags (e.g. nsdelegate, favordynmods) were previously
> handled via scattered switch-case and conditional checks across
> parameter parsing, flag application, and option display paths. This
> leads to redundant code and increased maintenance cost when adding/removing
> flags.
>
> Introduce a `cgroup_mount_flag_desc` descriptor table to centralize the
> mapping between flag bits, names, and apply functions. Refactor the
> relevant paths to use this table for unified management:
> 1. cgroup2_parse_param: Replace switch-case with table lookup
> 2. apply_cgroup_root_flags: Replace multiple conditionals with table
> iteration
> 3. cgroup_show_options: Replace hardcoded seq_puts with table-driven output
>
> No functional change intended, and the mount option output format remains
> compatible with the original implementation.
>
Hi all,
Would anyone be interested?
--
Best regards,
Ridong