Re: [RFC PATCH bpf-next 3/8] bpf: Add kfuncs for cgroup1 hierarchy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 07, 2023 at 02:02:59PM +0000, Yafang Shao wrote:
> +
> +/**
> + * bpf_task_cgroup_id_within_hierarchy - Retrieves the associated cgroup ID of a
> + * task within a specific cgroup1 hierarchy.
> + * @task: The target task
> + * @hierarchy_id: The ID of a cgroup1 hierarchy
> + */
> +__bpf_kfunc u64 bpf_task_cgroup1_id_within_hierarchy(struct task_struct *task, int hierarchy_id)
> +{
> +	return task_cgroup1_id_within_hierarchy(task, hierarchy_id);
> +}
> +
> +/**
> + * bpf_task_ancestor_cgroup_id_within_hierarchy - Retrieves the associated
> + * ancestor cgroup ID of a task within a specific cgroup1 hierarchy.
> + * @task: The target task
> + * @hierarchy_id: The ID of a cgroup1 hierarchy
> + * @ancestor_level: The cgroup level of the ancestor in the cgroup1 hierarchy
> + */
> +__bpf_kfunc u64 bpf_task_ancestor_cgroup1_id_within_hierarchy(struct task_struct *task,
> +							      int hierarchy_id, int ancestor_level)
> +{
> +	return task_ancestor_cgroup1_id_within_hierarchy(task, hierarchy_id, ancestor_level);
> +}

The same here. Please make one helper that returns a kptr and then let the
user call bpf_cgroup_ancestor() if desired.

Thanks.

-- 
tejun




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux