diff options
author | David Howells <dhowells@redhat.com> | 2013-04-12 13:03:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-01 17:29:47 -0400 |
commit | c30480b92cf497aa3b463367a82f1c2fdc5c46e9 (patch) | |
tree | be6dea0c5a45bd60a03ae99efdda0eb365db884a | |
parent | a8ca16ea7b0abb0a7e49492d1123b715f0ec62e8 (diff) |
proc: Make the PROC_I() and PDE() macros internal to procfs
Make the PROC_I() and PDE() macros internal to procfs. This means making
PDE_DATA() out of line. This could be made more optimal by storing
PDE()->data into inode->i_private.
Also provide a __PDE_DATA() that is inline and internal to procfs.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/proc/generic.c | 8 | ||||
-rw-r--r-- | fs/proc/internal.h | 18 | ||||
-rw-r--r-- | fs/proc/proc_devtree.c | 2 | ||||
-rw-r--r-- | include/linux/proc_fs.h | 17 |
4 files changed, 28 insertions, 17 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index d9631d9b7aff..a2596afffae6 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -165,7 +165,7 @@ void proc_free_inum(unsigned int inum) | |||
165 | 165 | ||
166 | static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) | 166 | static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) |
167 | { | 167 | { |
168 | nd_set_link(nd, PDE_DATA(dentry->d_inode)); | 168 | nd_set_link(nd, __PDE_DATA(dentry->d_inode)); |
169 | return NULL; | 169 | return NULL; |
170 | } | 170 | } |
171 | 171 | ||
@@ -631,3 +631,9 @@ void proc_remove(struct proc_dir_entry *de) | |||
631 | remove_proc_subtree(de->name, de->parent); | 631 | remove_proc_subtree(de->name, de->parent); |
632 | } | 632 | } |
633 | EXPORT_SYMBOL(proc_remove); | 633 | EXPORT_SYMBOL(proc_remove); |
634 | |||
635 | void *PDE_DATA(const struct inode *inode) | ||
636 | { | ||
637 | return __PDE_DATA(inode); | ||
638 | } | ||
639 | EXPORT_SYMBOL(PDE_DATA); | ||
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index c529b5f16ee4..86a24060e1b9 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -84,6 +84,24 @@ struct proc_maps_private { | |||
84 | 84 | ||
85 | void proc_init_inodecache(void); | 85 | void proc_init_inodecache(void); |
86 | 86 | ||
87 | /* | ||
88 | * General functions | ||
89 | */ | ||
90 | static inline struct proc_inode *PROC_I(const struct inode *inode) | ||
91 | { | ||
92 | return container_of(inode, struct proc_inode, vfs_inode); | ||
93 | } | ||
94 | |||
95 | static inline struct proc_dir_entry *PDE(const struct inode *inode) | ||
96 | { | ||
97 | return PROC_I(inode)->pde; | ||
98 | } | ||
99 | |||
100 | static inline void *__PDE_DATA(const struct inode *inode) | ||
101 | { | ||
102 | return PDE(inode)->data; | ||
103 | } | ||
104 | |||
87 | static inline struct pid *proc_pid(struct inode *inode) | 105 | static inline struct pid *proc_pid(struct inode *inode) |
88 | { | 106 | { |
89 | return PROC_I(inode)->pid; | 107 | return PROC_I(inode)->pid; |
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index e0043c7e7ab7..505afc950e0a 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -41,7 +41,7 @@ static int property_proc_show(struct seq_file *m, void *v) | |||
41 | 41 | ||
42 | static int property_proc_open(struct inode *inode, struct file *file) | 42 | static int property_proc_open(struct inode *inode, struct file *file) |
43 | { | 43 | { |
44 | return single_open(file, property_proc_show, PDE_DATA(inode)); | 44 | return single_open(file, property_proc_show, __PDE_DATA(inode)); |
45 | } | 45 | } |
46 | 46 | ||
47 | static const struct file_operations property_proc_fops = { | 47 | static const struct file_operations property_proc_fops = { |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index cb78d5be6859..2112926de854 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -87,6 +87,7 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, | |||
87 | 87 | ||
88 | extern void proc_set_size(struct proc_dir_entry *, loff_t); | 88 | extern void proc_set_size(struct proc_dir_entry *, loff_t); |
89 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); | 89 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); |
90 | extern void *PDE_DATA(const struct inode *); | ||
90 | extern void *proc_get_parent_data(const struct inode *); | 91 | extern void *proc_get_parent_data(const struct inode *); |
91 | #else | 92 | #else |
92 | 93 | ||
@@ -116,6 +117,7 @@ static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, | |||
116 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | 117 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } |
117 | static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} | 118 | static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} |
118 | static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} | 119 | static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} |
120 | static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} | ||
119 | 121 | ||
120 | #endif /* CONFIG_PROC_FS */ | 122 | #endif /* CONFIG_PROC_FS */ |
121 | 123 | ||
@@ -142,21 +144,6 @@ struct proc_inode { | |||
142 | struct inode vfs_inode; | 144 | struct inode vfs_inode; |
143 | }; | 145 | }; |
144 | 146 | ||
145 | static inline struct proc_inode *PROC_I(const struct inode *inode) | ||
146 | { | ||
147 | return container_of(inode, struct proc_inode, vfs_inode); | ||
148 | } | ||
149 | |||
150 | static inline struct proc_dir_entry *PDE(const struct inode *inode) | ||
151 | { | ||
152 | return PROC_I(inode)->pde; | ||
153 | } | ||
154 | |||
155 | static inline void *PDE_DATA(const struct inode *inode) | ||
156 | { | ||
157 | return PROC_I(inode)->pde->data; | ||
158 | } | ||
159 | |||
160 | static inline struct proc_dir_entry *proc_net_mkdir( | 147 | static inline struct proc_dir_entry *proc_net_mkdir( |
161 | struct net *net, const char *name, struct proc_dir_entry *parent) | 148 | struct net *net, const char *name, struct proc_dir_entry *parent) |
162 | { | 149 | { |