Commit a87bf44d authored by Ma Wupeng's avatar Ma Wupeng Committed by Wupeng Ma
Browse files

proc: introduce proc_hide_ents to hide proc files

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I96IZH



--------------------------------

Introduce proc_hide_ents to hide proc files.

Signed-off-by: default avatarMa Wupeng <mawupeng1@huawei.com>
parent efcbd7d2
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -2847,6 +2847,11 @@ static struct dentry *proc_pident_instantiate(struct dentry *dentry,
	return d_splice_alias(inode, dentry);
}

static bool proc_hide_pidents(const struct pid_entry *p)
{
	return false;
}

static struct dentry *proc_pident_lookup(struct inode *dir, 
					 struct dentry *dentry,
					 const struct pid_entry *p,
@@ -2865,6 +2870,8 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
	for (; p < end; p++) {
		if (p->len != dentry->d_name.len)
			continue;
		if (proc_hide_pidents(p))
			continue;
		if (!memcmp(dentry->d_name.name, p->name, p->len)) {
			res = proc_pident_instantiate(dentry, task, p);
			break;
@@ -2891,7 +2898,8 @@ static int proc_pident_readdir(struct file *file, struct dir_context *ctx,
		goto out;

	for (p = ents + (ctx->pos - 2); p < ents + nents; p++) {
		if (!proc_fill_cache(file, ctx, p->name, p->len,
		if (!proc_hide_pidents(p) &&
		    !proc_fill_cache(file, ctx, p->name, p->len,
				     proc_pident_instantiate, task, p))
			break;
		ctx->pos++;