Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdce6bf8 authored by Tejun Heo's avatar Tejun Heo
Browse files

cgroup: remove NULL checks from [pr_cont_]cgroup_{name|path}()



The dummy hierarchy is now a fully functional one and dummy_top has a
kernfs_node associated with it.  Drop the NULL checks in
[pr_cont_]cont_{name|path}() which are no longer necessary.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
parent 985ed670
Loading
Loading
Loading
Loading
+4 −20
Original line number Diff line number Diff line
@@ -508,39 +508,23 @@ struct cgroup_subsys_state *seq_css(struct seq_file *seq);

static inline int cgroup_name(struct cgroup *cgrp, char *buf, size_t buflen)
{
	/* dummy_top doesn't have a kn associated */
	if (cgrp->kn)
	return kernfs_name(cgrp->kn, buf, buflen);
	else
		return strlcpy(buf, "/", buflen);
}

static inline char * __must_check cgroup_path(struct cgroup *cgrp, char *buf,
					      size_t buflen)
{
	/* dummy_top doesn't have a kn associated */
	if (cgrp->kn)
	return kernfs_path(cgrp->kn, buf, buflen);
	strlcpy(buf, "/", buflen);
	return (buflen <= 2) ? NULL : buf;
}

static inline void pr_cont_cgroup_name(struct cgroup *cgrp)
{
	/* dummy_top doesn't have a kn associated */
	if (cgrp->kn)
	pr_cont_kernfs_name(cgrp->kn);
	else
		pr_cont("/");
}

static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
{
	/* dummy_top doesn't have a kn associated */
	if (cgrp->kn)
	pr_cont_kernfs_path(cgrp->kn);
	else
		pr_cont("/");
}

char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);