proc: cleanup the compat vs no compat file ops
Instead of providing a special no-compat version provide a special compat version for operations with ->compat_ioctl. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
f6ef7b7bb2
commit
906146f449
|
|
@ -572,9 +572,6 @@ static const struct file_operations proc_reg_file_ops = {
|
||||||
.write = proc_reg_write,
|
.write = proc_reg_write,
|
||||||
.poll = proc_reg_poll,
|
.poll = proc_reg_poll,
|
||||||
.unlocked_ioctl = proc_reg_unlocked_ioctl,
|
.unlocked_ioctl = proc_reg_unlocked_ioctl,
|
||||||
#ifdef CONFIG_COMPAT
|
|
||||||
.compat_ioctl = proc_reg_compat_ioctl,
|
|
||||||
#endif
|
|
||||||
.mmap = proc_reg_mmap,
|
.mmap = proc_reg_mmap,
|
||||||
.get_unmapped_area = proc_reg_get_unmapped_area,
|
.get_unmapped_area = proc_reg_get_unmapped_area,
|
||||||
.open = proc_reg_open,
|
.open = proc_reg_open,
|
||||||
|
|
@ -582,12 +579,13 @@ static const struct file_operations proc_reg_file_ops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
static const struct file_operations proc_reg_file_ops_no_compat = {
|
static const struct file_operations proc_reg_file_ops_compat = {
|
||||||
.llseek = proc_reg_llseek,
|
.llseek = proc_reg_llseek,
|
||||||
.read = proc_reg_read,
|
.read = proc_reg_read,
|
||||||
.write = proc_reg_write,
|
.write = proc_reg_write,
|
||||||
.poll = proc_reg_poll,
|
.poll = proc_reg_poll,
|
||||||
.unlocked_ioctl = proc_reg_unlocked_ioctl,
|
.unlocked_ioctl = proc_reg_unlocked_ioctl,
|
||||||
|
.compat_ioctl = proc_reg_compat_ioctl,
|
||||||
.mmap = proc_reg_mmap,
|
.mmap = proc_reg_mmap,
|
||||||
.get_unmapped_area = proc_reg_get_unmapped_area,
|
.get_unmapped_area = proc_reg_get_unmapped_area,
|
||||||
.open = proc_reg_open,
|
.open = proc_reg_open,
|
||||||
|
|
@ -646,8 +644,8 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
|
||||||
inode->i_op = de->proc_iops;
|
inode->i_op = de->proc_iops;
|
||||||
inode->i_fop = &proc_reg_file_ops;
|
inode->i_fop = &proc_reg_file_ops;
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
if (!de->proc_ops->proc_compat_ioctl)
|
if (de->proc_ops->proc_compat_ioctl)
|
||||||
inode->i_fop = &proc_reg_file_ops_no_compat;
|
inode->i_fop = &proc_reg_file_ops_compat;
|
||||||
#endif
|
#endif
|
||||||
} else if (S_ISDIR(inode->i_mode)) {
|
} else if (S_ISDIR(inode->i_mode)) {
|
||||||
inode->i_op = de->proc_iops;
|
inode->i_op = de->proc_iops;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue