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: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -58,7 +58,7 @@ static int ide_imodel_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_imodel_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_imodel_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_imodel_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations ide_imodel_proc_fops = {
|
||||
@@ -82,7 +82,7 @@ static int ide_mate_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_mate_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_mate_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_mate_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations ide_mate_proc_fops = {
|
||||
@@ -103,7 +103,7 @@ static int ide_channel_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_channel_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_channel_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_channel_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations ide_channel_proc_fops = {
|
||||
@@ -143,7 +143,7 @@ static int ide_identify_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_identify_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_identify_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_identify_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations ide_identify_proc_fops = {
|
||||
@@ -325,7 +325,7 @@ static int ide_settings_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_settings_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_settings_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_settings_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
#define MAX_LEN 30
|
||||
@@ -333,7 +333,7 @@ static int ide_settings_proc_open(struct inode *inode, struct file *file)
|
||||
static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data;
|
||||
ide_drive_t *drive = PDE_DATA(file_inode(file));
|
||||
char name[MAX_LEN + 1];
|
||||
int for_real = 0, mul_factor, div_factor;
|
||||
unsigned long n;
|
||||
@@ -474,7 +474,7 @@ static int ide_geometry_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_geometry_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_geometry_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_geometry_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
const struct file_operations ide_geometry_proc_fops = {
|
||||
@@ -497,7 +497,7 @@ static int ide_dmodel_proc_show(struct seq_file *seq, void *v)
|
||||
|
||||
static int ide_dmodel_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_dmodel_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_dmodel_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations ide_dmodel_proc_fops = {
|
||||
@@ -525,7 +525,7 @@ static int ide_driver_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_driver_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_driver_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_driver_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
|
||||
@@ -558,7 +558,7 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
|
||||
static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data;
|
||||
ide_drive_t *drive = PDE_DATA(file_inode(file));
|
||||
char name[32];
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
@@ -601,7 +601,7 @@ static int ide_media_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int ide_media_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ide_media_proc_show, PDE(inode)->data);
|
||||
return single_open(file, ide_media_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations ide_media_proc_fops = {
|
||||
|
Reference in New Issue
Block a user