Skip to content

Commit 906146f

Browse files
Christoph HellwigAl Viro
authored andcommitted
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent f6ef7b7 commit 906146f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

fs/proc/inode.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,22 +572,20 @@ static const struct file_operations proc_reg_file_ops = {
572572
.write = proc_reg_write,
573573
.poll = proc_reg_poll,
574574
.unlocked_ioctl = proc_reg_unlocked_ioctl,
575-
#ifdef CONFIG_COMPAT
576-
.compat_ioctl = proc_reg_compat_ioctl,
577-
#endif
578575
.mmap = proc_reg_mmap,
579576
.get_unmapped_area = proc_reg_get_unmapped_area,
580577
.open = proc_reg_open,
581578
.release = proc_reg_release,
582579
};
583580

584581
#ifdef CONFIG_COMPAT
585-
static const struct file_operations proc_reg_file_ops_no_compat = {
582+
static const struct file_operations proc_reg_file_ops_compat = {
586583
.llseek = proc_reg_llseek,
587584
.read = proc_reg_read,
588585
.write = proc_reg_write,
589586
.poll = proc_reg_poll,
590587
.unlocked_ioctl = proc_reg_unlocked_ioctl,
588+
.compat_ioctl = proc_reg_compat_ioctl,
591589
.mmap = proc_reg_mmap,
592590
.get_unmapped_area = proc_reg_get_unmapped_area,
593591
.open = proc_reg_open,
@@ -646,8 +644,8 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
646644
inode->i_op = de->proc_iops;
647645
inode->i_fop = &proc_reg_file_ops;
648646
#ifdef CONFIG_COMPAT
649-
if (!de->proc_ops->proc_compat_ioctl)
650-
inode->i_fop = &proc_reg_file_ops_no_compat;
647+
if (de->proc_ops->proc_compat_ioctl)
648+
inode->i_fop = &proc_reg_file_ops_compat;
651649
#endif
652650
} else if (S_ISDIR(inode->i_mode)) {
653651
inode->i_op = de->proc_iops;

0 commit comments

Comments
 (0)