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

Commit d9dda78b authored by Al Viro's avatar Al Viro
Browse files

procfs: new helper - PDE_DATA(inode)



The only part of proc_dir_entry the code outside of fs/proc
really cares about is PDE(inode)->data.  Provide a helper
for that; static inline for now, eventually will be moved
to fs/proc, along with the knowledge of struct proc_dir_entry
layout.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 8510e30b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -104,14 +104,14 @@ static int srm_env_proc_show(struct seq_file *m, void *v)

static int srm_env_proc_open(struct inode *inode, struct file *file)
{
	return single_open(file, srm_env_proc_show, PDE(inode)->data);
	return single_open(file, srm_env_proc_show, PDE_DATA(inode));
}

static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
				  size_t count, loff_t *pos)
{
	int res;
	srm_env_t	*entry = PDE(file_inode(file))->data;
	srm_env_t	*entry = PDE_DATA(file_inode(file));
	char		*buf = (char *) __get_free_page(GFP_USER);
	unsigned long	ret1, ret2;

+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ struct buffer {
static ssize_t atags_read(struct file *file, char __user *buf,
			  size_t count, loff_t *ppos)
{
	struct buffer *b = PDE(file_inode(file))->data;
	struct buffer *b = PDE_DATA(file_inode(file));
	return simple_read_from_buffer(buf, count, ppos, b->data, b->size);
}

+1 −3
Original line number Diff line number Diff line
@@ -116,14 +116,12 @@ static const struct seq_operations cplbinfo_sops = {

static int cplbinfo_open(struct inode *inode, struct file *file)
{
	struct proc_dir_entry *pde = PDE(file_inode(file));
	char cplb_type;
	unsigned int cpu;
	unsigned int cpu = (unsigned long)PDE_DATA(file_inode(file));
	int ret;
	struct seq_file *m;
	struct cplbinfo_data *cdata;

	cpu = (unsigned int)pde->data;
	cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I';
	cpu &= ~CPLBINFO_DCPLB_FLAG;

+5 −13
Original line number Diff line number Diff line
@@ -301,9 +301,7 @@ salinfo_event_open(struct inode *inode, struct file *file)
static ssize_t
salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
	struct inode *inode = file_inode(file);
	struct proc_dir_entry *entry = PDE(inode);
	struct salinfo_data *data = entry->data;
	struct salinfo_data *data = PDE_DATA(file_inode(file));
	char cmd[32];
	size_t size;
	int i, n, cpu = -1;
@@ -360,8 +358,7 @@ static const struct file_operations salinfo_event_fops = {
static int
salinfo_log_open(struct inode *inode, struct file *file)
{
	struct proc_dir_entry *entry = PDE(inode);
	struct salinfo_data *data = entry->data;
	struct salinfo_data *data = PDE_DATA(inode);

	if (!capable(CAP_SYS_ADMIN))
		return -EPERM;
@@ -386,8 +383,7 @@ salinfo_log_open(struct inode *inode, struct file *file)
static int
salinfo_log_release(struct inode *inode, struct file *file)
{
	struct proc_dir_entry *entry = PDE(inode);
	struct salinfo_data *data = entry->data;
	struct salinfo_data *data = PDE_DATA(inode);

	if (data->state == STATE_NO_DATA) {
		vfree(data->log_buffer);
@@ -463,9 +459,7 @@ retry:
static ssize_t
salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
	struct inode *inode = file_inode(file);
	struct proc_dir_entry *entry = PDE(inode);
	struct salinfo_data *data = entry->data;
	struct salinfo_data *data = PDE_DATA(file_inode(file));
	u8 *buf;
	u64 bufsize;

@@ -524,9 +518,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)
static ssize_t
salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
	struct inode *inode = file_inode(file);
	struct proc_dir_entry *entry = PDE(inode);
	struct salinfo_data *data = entry->data;
	struct salinfo_data *data = PDE_DATA(file_inode(file));
	char cmd[32];
	size_t size;
	u32 offset;
+2 −2
Original line number Diff line number Diff line
@@ -58,13 +58,13 @@ static int pvc_line_proc_show(struct seq_file *m, void *v)

static int pvc_line_proc_open(struct inode *inode, struct file *file)
{
	return single_open(file, pvc_line_proc_show, PDE(inode)->data);
	return single_open(file, pvc_line_proc_show, PDE_DATA(inode));
}

static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
				   size_t count, loff_t *pos)
{
	int lineno = *(int *)PDE(file_inode(file))->data;
	int lineno = *(int *)PDE_DATA(file_inode(file));
	char kbuf[PVC_LINELEN];
	size_t len;

Loading