Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

compat_ioctl: block: handle cdrom compat ioctl in non-cdrom drivers

Various block drivers implement the CDROMMULTISESSION,
CDROM_GET_CAPABILITY, and CDROMEJECT ioctl commands, relying on the
block layer to handle compat_ioctl mode for them.

Move this into the drivers directly as a preparation for simplifying
the block layer later.

When only integer arguments or no arguments are passed, the
same handler can be used for .ioctl and .compat_ioctl, and
when only pointer arguments are passed, the newly added
blkdev_compat_ptr_ioctl can be used.

Reviewed-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+7
+3
drivers/block/floppy.c
··· 3879 3879 { 3880 3880 int drive = (long)bdev->bd_disk->private_data; 3881 3881 switch (cmd) { 3882 + case CDROMEJECT: /* CD-ROM eject */ 3883 + case 0x6470: /* SunOS floppy eject */ 3884 + 3882 3885 case FDMSGON: 3883 3886 case FDMSGOFF: 3884 3887 case FDSETEMSGTRESH:
+1
drivers/block/paride/pd.c
··· 874 874 .open = pd_open, 875 875 .release = pd_release, 876 876 .ioctl = pd_ioctl, 877 + .compat_ioctl = pd_ioctl, 877 878 .getgeo = pd_getgeo, 878 879 .check_events = pd_check_events, 879 880 .revalidate_disk= pd_revalidate
+1
drivers/block/paride/pf.c
··· 276 276 .open = pf_open, 277 277 .release = pf_release, 278 278 .ioctl = pf_ioctl, 279 + .compat_ioctl = pf_ioctl, 279 280 .getgeo = pf_getgeo, 280 281 .check_events = pf_check_events, 281 282 };
+1
drivers/block/sunvdc.c
··· 171 171 .owner = THIS_MODULE, 172 172 .getgeo = vdc_getgeo, 173 173 .ioctl = vdc_ioctl, 174 + .compat_ioctl = blkdev_compat_ptr_ioctl, 174 175 }; 175 176 176 177 static void vdc_blk_queue_start(struct vdc_port *port)
+1
drivers/block/xen-blkfront.c
··· 2632 2632 .release = blkif_release, 2633 2633 .getgeo = blkif_getgeo, 2634 2634 .ioctl = blkif_ioctl, 2635 + .compat_ioctl = blkdev_compat_ptr_ioctl, 2635 2636 }; 2636 2637 2637 2638