compat_ioctl: simplify up block/ioctl.c
authorArnd Bergmann <arnd@arndb.de>
Fri, 29 Nov 2019 10:48:31 +0000 (11:48 +0100)
committerArnd Bergmann <arnd@arndb.de>
Fri, 3 Jan 2020 08:42:52 +0000 (09:42 +0100)
commit9b81648cb5e3ae7296825f0c8d2f98e50631ee84
tree2a971e392be7ea804073fe035c969bc5f519f2d7
parent5fb889f587fa2ae486e067d8a00df955ae6492b3
compat_ioctl: simplify up block/ioctl.c

Having separate implementations of blkdev_ioctl() often leads to these
getting out of sync, despite the comment at the top.

Since most of the ioctl commands are compatible, and we try very hard
not to add any new incompatible ones, move all the common bits into a
shared function and leave only the ones that are historically different
in separate functions for native/compat mode.

To deal with the compat_ptr() conversion, pass both the integer
argument and the pointer argument into the new blkdev_common_ioctl()
and make sure to always use the correct one of these.

blkdev_ioctl() is now only kept as a separate exported interfact
for drivers/char/raw.c, which lacks a compat_ioctl variant.
We should probably either move raw.c to staging if there are no
more users, or export blkdev_compat_ioctl() as well.

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