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

Commit c30480b9 authored by David Howells's avatar David Howells Committed by Al Viro
Browse files

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: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a8ca16ea
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ void proc_free_inum(unsigned int inum)

static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
{
	nd_set_link(nd, PDE_DATA(dentry->d_inode));
	nd_set_link(nd, __PDE_DATA(dentry->d_inode));
	return NULL;
}

@@ -631,3 +631,9 @@ void proc_remove(struct proc_dir_entry *de)
		remove_proc_subtree(de->name, de->parent);
}
EXPORT_SYMBOL(proc_remove);

void *PDE_DATA(const struct inode *inode)
{
	return __PDE_DATA(inode);
}
EXPORT_SYMBOL(PDE_DATA);
+18 −0
Original line number Diff line number Diff line
@@ -84,6 +84,24 @@ struct proc_maps_private {

void proc_init_inodecache(void);

/*
 * General functions
 */
static inline struct proc_inode *PROC_I(const struct inode *inode)
{
	return container_of(inode, struct proc_inode, vfs_inode);
}

static inline struct proc_dir_entry *PDE(const struct inode *inode)
{
	return PROC_I(inode)->pde;
}

static inline void *__PDE_DATA(const struct inode *inode)
{
	return PDE(inode)->data;
}

static inline struct pid *proc_pid(struct inode *inode)
{
	return PROC_I(inode)->pid;
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ static int property_proc_show(struct seq_file *m, void *v)

static int property_proc_open(struct inode *inode, struct file *file)
{
	return single_open(file, property_proc_show, PDE_DATA(inode));
	return single_open(file, property_proc_show, __PDE_DATA(inode));
}

static const struct file_operations property_proc_fops = {
+2 −15
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
 
extern void proc_set_size(struct proc_dir_entry *, loff_t);
extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
extern void *PDE_DATA(const struct inode *);
extern void *proc_get_parent_data(const struct inode *);
#else

@@ -116,6 +117,7 @@ static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
	umode_t mode, struct proc_dir_entry *parent) { return NULL; }
static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}

#endif /* CONFIG_PROC_FS */

@@ -142,21 +144,6 @@ struct proc_inode {
	struct inode vfs_inode;
};

static inline struct proc_inode *PROC_I(const struct inode *inode)
{
	return container_of(inode, struct proc_inode, vfs_inode);
}

static inline struct proc_dir_entry *PDE(const struct inode *inode)
{
	return PROC_I(inode)->pde;
}

static inline void *PDE_DATA(const struct inode *inode)
{
	return PROC_I(inode)->pde->data;
}

static inline struct proc_dir_entry *proc_net_mkdir(
	struct net *net, const char *name, struct proc_dir_entry *parent)
{