diff mbox series

[1/4] fs: proc: store PDE()->data into inode->i_private

Message ID 20211101093518.86845-2-songmuchun@bytedance.com (mailing list archive)
State New, archived
Headers show
Series remove PDE_DATA() | expand

Commit Message

Muchun Song Nov. 1, 2021, 9:35 a.m. UTC
PDE_DATA(inode) is introduced to get user private data and hide the
layout of struct proc_dir_entry. The inode->i_private is used to do
the same thing as well. Save a copy of user private data to inode->
i_private when proc inode is allocated. This means the user also can
get their private data by inode->i_private.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 fs/proc/inode.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 599eb724ff2d..f84355c5a36d 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -650,6 +650,7 @@  struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
 		return NULL;
 	}
 
+	inode->i_private = de->data;
 	inode->i_ino = de->low_ino;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
 	PROC_I(inode)->pde = de;