Hello.

Just some questions and readability suggestion.

On Mon, May 11, 2020 at 09:30:13AM -0600, Tom Hromatka 
<tom.hroma...@oracle.com> wrote:
> This commit adds cgroup v2 support to cgroup_init(). With these
> changes, cgget and cgset now work on a cgroup v1 mount, a cgroup
> v2 mount, or a cgroup v2 unified mount hierarchy.
What exactly is the difference between the last two mounts?
Would they be treated differently?

Would the cgset really work on v2 hierarchy if controller
cgroup.subtree_control isn't modified? (I don't mean extending the patch
but rather better describe it in its message.)

> +     stok_buff = strtok(ret_c, " ");
> +     while (stok_buff) {
while ((stok_buff = strtok(ret_c, " "))

> +             if (duplicate) {
> +                     cgroup_dbg("controller %s is already mounted on %s\n",
> +                             stok_buff, cg_mount_table[i].mount.path);
> +
> +                     ret = cg_add_duplicate_mount(&cg_mount_table[i],
> +                                     ent->mnt_dir);
> +                     if (ret)
> +                             goto out;
goto unnecessary, use break.

> +
> +                     /* advance to the next controller */
> +                     stok_buff = strtok(NULL, " ");
> +                     continue;
Same strtok at three places is asking for bugs. See the suggested
while() condition above.
Also why not use strtok_r for consistency with cgroup_process_v1_mount?

> +             }
> +
> [...]
> +
> +             /* advance to the next controller */
> +             stok_buff = strtok(NULL, " ");
The third.


Michal

_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to